[Catalyst] Session duplicate key constraints on concurrent
requests
Janne Snabb
snabb at epipe.com
Fri Oct 7 19:25:40 GMT 2011
On Fri, 7 Oct 2011, Janne Snabb wrote:
> Something like this perhaps? Untested code.
Sorry about flooding. This is another much simpler solution but works
only on MySQL. I think there is no standard SQL syntax to accomplish
the same without extra DB fields.
--
Janne Snabb / EPIPE Communications
snabb at epipe.com - http://epipe.com/
diff -U5 -r Catalyst-Plugin-Session-Store-DBI-0.16/lib/Catalyst/Plugin/Session/Store/DBI.pm Catalyst-Plugin-Session-Store-DBI-0.16+otherpatch/lib/Catalyst/Plugin/Session/Store/DBI.pm
--- Catalyst-Plugin-Session-Store-DBI-0.16/lib/Catalyst/Plugin/Session/Store/DBI.pm 2010-03-24 04:47:13.000000000 +0700
+++ Catalyst-Plugin-Session-Store-DBI-0.16+otherpatch/lib/Catalyst/Plugin/Session/Store/DBI.pm 2011-10-08 02:21:12.227212244 +0700
@@ -156,11 +156,11 @@
check_existing =>
"SELECT 1 FROM $table WHERE $id_field = ?",
update_session =>
"UPDATE $table SET $data_field = ?, $expires_field = ? WHERE $id_field = ?",
insert_session =>
- "INSERT INTO $table ($data_field, $expires_field, $id_field) VALUES (?, ?, ?)",
+ "INSERT IGNORE INTO $table ($data_field, $expires_field, $id_field) VALUES (?, ?, ?)",
update_expires =>
"UPDATE $table SET $expires_field = ? WHERE $id_field = ?",
delete_session =>
"DELETE FROM $table WHERE $id_field = ?",
delete_expired_sessions =>
More information about the Catalyst
mailing list