From 9d6f1179385397d25482ad842dc3b98da06cd06f Mon Sep 17 00:00:00 2001 From: "Thies C. Arntzen" Date: Tue, 13 Feb 2001 20:13:14 +0000 Subject: [PATCH] remove stupid PGSQL warning --- ext/pgsql/pgsql.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index cbc09ba60f..1147323a47 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -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; } -- 2.50.1