#1361: Exception in AgaviPdoSessionStorage::sessionWrite() with MySQL if no data
modified on update
------------------------------------------+---------------------------------
Reporter: jeramy@… | Owner: david
Type: defect | Status: new
Priority: high | Milestone: 1.0.5
Component: storage | Version: 1.0.4
Severity: major | Keywords:
Has_patch: 0 |
------------------------------------------+---------------------------------
Comment(by david):
To clarify, this happens whenever no data in the session was changed, and
the write occurs within the same second as the previous update or insert.
Then, the ID, data and time will all be identical to what is already in
the database, causing MySQL to report no updated rows. The session handler
then assumes that the record for this session does not exist and attempts
an insert, which causes an error since the ID column is a primary key (or
at least it should be).
Switching the insert and update around does the job; protected by
transactions anyway if the database supports it, and no different in terms
of race conditions to what was done before if the database doesn't.
Tested with MySQL (also see #1374) and PostgreSQL, although the latter
doesn't seem affected by the original issue as it always reports the
"updated" row count even if no data was actually modified.
--
Ticket URL: <http://trac.agavi.org/ticket/1361#comment:2>
Agavi <http://www.agavi.org/>
An MVC Framework for PHP5
_______________________________________________
Agavi Tickets Mailing List
[email protected]
http://lists.agavi.org/mailman/listinfo/tickets