note 36332 deleted from function.pg-pconnect by danbrown
| From: | danbrown@php.net | Date: | Sun, 03 Apr 2022 21:06:27 +0000 |
| Subject: | note 36332 deleted from function.pg-pconnect by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-218007@lists.php.net to get a copy of this message | ||
Note Submitter: info at karl-philipp dot de
----
A contribution to the transaction issue raised by "garrett at bgb dot cc".
In a German book about PostgreSQL in connection with PHP (Cornelia Boenigk, PostgreSQL - Grundlagen,
Praxis, Anwendungsentwicklung mit PHP) one can read in chapter 19.3 about persistent connections:
If the page processing aborts and the transaction is not finished yet, the next script using the
same persistent connection will be considered as the continuation of the transaction. In particular
a lock of a table will persist. The explanation is as follows: After the abort of the script no
COMMIT or ROLLBACK was sent to the db server.
The author describes a hint to avoid the scenario above:
You can create a function for resolving transactions and locks erroneously not closed. For invoking
the function after execution of a script it has to be registered with the function
register_shutdown_function():
http://de2.php.net/manual/en/function.register-shutdown-function.php