From: des@des.no
To: pgsql-interfaces@postgresql.org
Subject: [PATCH] add notice processor to DBD::Pg
Date: Mon, 13 Sep 2004 23:16:08 +0200
Message-ID: <xzpd60pj2ef.fsf@dwp.des.no> (raw)
The attached patch adds a notice processor to DBD::Pg. While it
doesn't do much (just pass the mesage on to warn()), it allows Perl
scripts to intercept notices with the usual $SIG{__WARN__} mechanism.
DES
--
Dag-Erling Smørgrav - des@des.no
Attachments:
[text/x-patch] patch-dbdimp.c (629B, ../xzpd60pj2ef.fsf@dwp.des.no/2-patch-dbdimp.c)
download | inline diff:--- dbdimp.c.orig Sun Sep 12 13:26:17 2004+++ dbdimp.c Sun Sep 12 13:29:12 2004@@ -97,6 +97,12 @@
free(err);
}
+static void+pg_notice(void *arg, const char *message)+{+ warn("%s", message);+}+
static int
pgtype_bind_ok (dbtype)
int dbtype;
@@ -182,6 +188,9 @@
/* make a connection to the database */
imp_dbh->conn = PQconnectdb(conn_str);
free(conn_str);
++ /* install notice processor */+ PQsetNoticeProcessor(imp_dbh->conn, pg_notice, imp_dbh->conn);
/* check to see that the backend connection was successfully made */
if (PQstatus(imp_dbh->conn) != CONNECTION_OK) {
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: des@des.no
Subject: Re: [PATCH] add notice processor to DBD::Pg
In-Reply-To: <xzpd60pj2ef.fsf@dwp.des.no>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox