From: L J Bayuk <ljb220@mindspring.com>
To: peter_e@gmx.net
Cc: jgardner@jonathangardner.net
Cc: pgsql-interfaces@postgresql.org
Subject: Re: PQsetNoticeReceiver issues
Date: Sun, 18 Jan 2004 21:38:30 -0500 (EST)
Message-ID: <200401190238.i0J2cUwB000262@mindspring.com> (raw)
In-Reply-To: <200401181119.58577.peter_e@gmx.net>
Peter Eisentraut wrote:
>
> Jonathan Gardner wrote:
> > I've run into a conundrum with the PQsetNoticeReceiver function call.
> > How do you set it back to the original default? How do you call the
> > appropriate PQnoticeProcessor as well?
>
> The documentation says:
>
> Each of these functions returns the previous notice receiver or
> processor function pointer, and sets the new value. If you supply a
> null function pointer, no action is taken, but the current pointer is
> returned.
Saving and restoring the previous noticeProcessor or noticeReceiver handler
function works, unless they actually made use of the "arg" pass-through
argument. For example, somewhere you have:
PQsetNoticeProcessor(conn, myNoticeProc, &mydata);
And somewhere else you want to temporarily override the noticeProcessor:
prevNoticeProc = PQsetNoticeProcessor(conn, newNoticeProc, &newdata);
/* ... Do something which makes a notice ... */
/* Restore previous notice processor */
PQsetNoticeProcessor(conn, prevNoticeProc, ????);
/* Oops, lost the previous "arg". */
Not exactly a huge API hole, but nevertheless...
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: ljb220@mindspring.com, peter_e@gmx.net, jgardner@jonathangardner.net
Subject: Re: PQsetNoticeReceiver issues
In-Reply-To: <200401190238.i0J2cUwB000262@mindspring.com>
* 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