note 33994 added to function.mysql-pconnect
| From: | rochlin at centralpets dot com | Date: | Sun, 13 Jul 2003 01:27:39 +0000 |
| Subject: | note 33994 added to function.mysql-pconnect | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-51998@lists.php.net to get a copy of this message | ||
Do not use transactions (e.g. with InnoDB MySQL tables) with persistent connections. If your script
stops or exits for any reason, your transaction will be left open and your locks will be left on.
You have to reset MySQL to release them (so far as I can figure). They won't ROLLBACK
automatically on error, like they ought to. When you restart the script, you'll get a new
connection, so you can't rollback or commit for the previous script. Any script with a start
transaction, rollback, or commit SQL statement should use regular (not persistent) connections.
Seems like PHP ought to automatically issue a ROLLBACK on any open transactions when a script exits
(error or otherwise) without a COMMIT. ZEND's site has a brief blurb on this. It's OK to
mix/match so you use a persistent connection for the read stuff, but open a new regular connection
conditionally (if you have to update, which is usually less often).
----
Manual Page -- http://www.php.net/manual/en/function.mysql-pconnect.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33994
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33994&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33994&report=yes