X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-pq;a=blobdiff_plain;f=src%2Fphp_pq.c;h=a465eeddb99db1f52d0b133162a9d1d3bf6709eb;hp=e298d2b8ea5aad37d728233abdfba1cc7ebf1811;hb=3bb2c115b2e3d14b2de84114dbffc58f3b71fae5;hpb=a09c92a19b36f486762ff952fed6a9907946a1d5;ds=sidebyside diff --git a/src/php_pq.c b/src/php_pq.c index e298d2b..a465eed 100644 --- a/src/php_pq.c +++ b/src/php_pq.c @@ -1803,8 +1803,9 @@ static void php_pqconn_persistent_resource_factory_dtor(void *opaque, void *hand { PGresult *res; + /* 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); }