]> granicus.if.org Git - php/commitdiff
remove stupid PGSQL warning
authorThies C. Arntzen <thies@php.net>
Tue, 13 Feb 2001 20:13:14 +0000 (20:13 +0000)
committerThies C. Arntzen <thies@php.net>
Tue, 13 Feb 2001 20:13:14 +0000 (20:13 +0000)
ext/pgsql/pgsql.c

index cbc09ba60f9f980bdba076aa2b6cba3dd8c6bb73..1147323a47aa2e11a5caaea7c6155dce7261be08 100644 (file)
@@ -145,25 +145,23 @@ static void _close_pgsql_plink(zend_rsrc_list_entry *rsrc)
        PGG(num_links)--;
 }
 
+static void _be_quiet(void * arg, const char * message)
+{
+}
+
 static int _rollback_transactions(zend_rsrc_list_entry *rsrc)
 {
        PGconn *link = (PGconn *)rsrc->ptr;
-       /*
-       PGresult *pg_result;
-       ExecStatusType status;
-       */
+       PQnoticeProcessor old_notice_hook;
 
-       PQexec(link,"BEGIN;ROLLBACK;");
+       /* we set the  PQsetNoticeProcessor to avoid the stupid 
+        * "NOTICE:  BEGIN: already a transaction in progress"
+        * message
+        */ 
 
-       /* maybe do error handling later....
-       pg_result = PQexec(link,"BEGIN;ROLLBACK;");
-       
-       if (pg_result) {
-               status = PQresultStatus(pg_result);
-       } else {
-               status = (ExecStatusType) PQstatus(link);
-       }
-       */
+       old_notice_hook = PQsetNoticeProcessor(link, _be_quiet, NULL);
+       PQexec(link,"BEGIN;ROLLBACK;");
+       PQsetNoticeProcessor(link, old_notice_hook, NULL);
 
        return 0;
 }