[TYPO3-core] RFC: Bug 4581: Duplicate entry on cache_pagesection on reloading twice

Oliver Hader oh at inpublica.de
Tue Jan 23 16:22:23 CET 2007


This is a SVN patch request.

Situation:
When more visitory come to a page in Frontend at nearly the same time
and caching is disabled (config.no_cache=1) SQL errors occur. As single
user it can be reproduced on fast reloading the same page.

Problem:
SQL error "duplicate entry" for query "INSERT INTO cache_pagesection".
First an UPDATE query is sent to the database in hope that a
corresponding record exists. Afterwards mysql_affected_rows is used to
determine if the previous query was successful. If the UPDATE failed, a
INSERT query is sent.
mysql_affected_rows [1] also fails (returns zero) if the records exists
but wasn't updated because old values were equal to new values. And then
also an INSERT is sent. And this produces the "duplicate entry" error.

Solution:
Replace mysql_affected_rows by mysql_info [2] which returns some more
information and can tell, what happened on database.

Comments:
mysql_info is available since PHP 4.3.0 what shouln't be a problem for
4.1.x - as the recent decision shows.

Bugtracker reference:
http://bugs.typo3.org/view.php?id=4581

Branch:
Trunk only


olly


[1] http://www.php.net/mysql_affected_rows
[2] http://www.php.net/mysql_info
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004581.patch
Type: text/x-diff
Size: 1929 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20070123/e1f555fb/attachment.bin 


More information about the TYPO3-team-core mailing list