1
0
mirror of https://github.com/danog/ext-pq.git synced 2024-12-02 17:28:35 +01:00

only rollback if transaction status indicates need of action

This commit is contained in:
Michael Wallner 2013-02-06 22:03:55 +01:00
parent a09c92a19b
commit 3bb2c115b2

View File

@ -1803,8 +1803,9 @@ static void php_pqconn_persistent_resource_factory_dtor(void *opaque, void *hand
{ {
PGresult *res; PGresult *res;
/* clean up */ /* clean up */
if ((res = PQexec(handle, "ROLLBACK; RESET ALL;"))) { if ((res = PQexec(handle, PQtransactionStatus(handle) == PQTRANS_IDLE ? "RESET ALL" : "ROLLBACK; RESET ALL"))) {
PHP_PQclear(res); PHP_PQclear(res);
} }