only rollback if transaction status indicates need of action
authorMichael Wallner <mike@php.net>
Wed, 6 Feb 2013 21:03:55 +0000 (22:03 +0100)
committerMichael Wallner <mike@php.net>
Wed, 6 Feb 2013 21:03:55 +0000 (22:03 +0100)
src/php_pq.c

index e298d2b8ea5aad37d728233abdfba1cc7ebf1811..a465eeddb99db1f52d0b133162a9d1d3bf6709eb 100644 (file)
@@ -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);
        }