pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feed[PATCH] add notice processor to DBD::Pg
3+ messages / 2 participants
[nested] [flat]
* [PATCH] add notice processor to DBD::Pg
@ 2004-09-13 21:16 Dag-Erling Smørgrav <des@des.no>
0 siblings, 1 reply; 3+ messages in thread
From: des@des.no @ 2004-09-13 21:16 UTC (permalink / raw)
To: pgsql-interfaces
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) {
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: [PATCH] add notice processor to DBD::Pg
@ 2004-09-13 21:26 Dag-Erling Smørgrav <des@des.no>
parent: Dag-Erling Smørgrav <des@des.no>
0 siblings, 1 reply; 3+ messages in thread
From: des@des.no @ 2004-09-13 21:26 UTC (permalink / raw)
To: pgsql-interfaces
des@des.no (Dag-Erling Smørgrav) writes:
> The attached patch adds a notice processor to DBD::Pg.
Mmf. Please disregard, I was looking at an older version. Recent
versions already have this feature.
DES
--
Dag-Erling Smørgrav - des@des.no
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: [PATCH] add notice processor to DBD::Pg
@ 2004-09-13 21:45 David Stanaway <david@stanaway.net>
parent: Dag-Erling Smørgrav <des@des.no>
0 siblings, 0 replies; 3+ messages in thread
From: David Stanaway @ 2004-09-13 21:45 UTC (permalink / raw)
To: pgsql-interfaces; +Cc: Dag-Erling Smørgrav <des@des.no>
On Mon, 2004-09-13 at 23:26 +0200, Dag-Erling Smørgrav wrote:
> des@des.no (Dag-Erling Smørgrav) writes:
> > The attached patch adds a notice processor to DBD::Pg.
>
> Mmf. Please disregard, I was looking at an older version. Recent
> versions already have this feature.
There are a few nice new things in the cvs version of the perl dbd
driver. Is there a reason that a new release is being held back?
--
David Stanaway <david@stanaway.net>
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2004-09-13 21:45 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-09-13 21:16 [PATCH] add notice processor to DBD::Pg Dag-Erling Smørgrav <des@des.no>
2004-09-13 21:26 ` Dag-Erling Smørgrav <des@des.no>
2004-09-13 21:45 ` David Stanaway <david@stanaway.net>
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