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
[email protected] - 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 =>

_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to