PEAR shutdown function doesn't rollback transactions
| From: | Bas | Date: | Mon, 08 Jul 2002 14:47:49 +0000 |
| Subject: | PEAR shutdown function doesn't rollback transactions | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-7561@lists.php.net to get a copy of this message | ||
Hi, I'm using PEAR to start transaction for database conections. While
reading in to this I saw the warning issued on the page below...
Now I saw that the registered PEAR shutdown function does not include any
rollback functionality... Is this something that should be done in future
releases? I noticed that the PEAR class does record the number of
transactions started...
Or am I missing the point entirely and should I implement something in my
own classes. (keep track of if any transactions have started and shutting
them down if they were not rollback or commited.
Alternatively I could use non persistent db connection...
Thx for any thoughts.
Bas
http://www.php.net/manual/en/features.persistent-connections.php
"There are a couple of additional caveats to keep in mind when using
persistent connections. One is that when using table locking on a persistent
connection, if the script for whatever reason cannot release the lock, then
subsequent scripts using the same connection will block indefinitely and may
require that you either restart the httpd server or the database server.
Another is that when using transactions, a transaction block will also carry
over to the next script which uses that connection if script execution ends
before the transaction block does. In either case, you canuse
register_shutdown_function() to register a simple cleanup function to unlock
your tables or roll back your transactions. Better yet, avoid the problem
entirely by not using persistent connections in scripts which use table
locks or transactions (you can still use them elsewhere)."