pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feedPQsetNoticeReceiver issues
3+ messages / 3 participants
[nested] [flat]
* PQsetNoticeReceiver issues
@ 2004-01-18 08:27 Jonathan Gardner <jgardner@jonathangardner.net>
0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Gardner @ 2004-01-18 08:27 UTC (permalink / raw)
To: pgsql-interfaces
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I'm writing a onion-skin thick wrapper around the libpq library in Python.
This is my way of getting back into C and also getting a lot more
familiar with PostgreSQL.
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?
I expected to find a function in the library like PQdefaultNoticeReceiver,
but either I'm looking at the wrong file or it doesn't exist. I also
expected to see PQdefaultNoticeProcessor, but nothing turned up. While
the documentation contains a neat implementation of a default
PQnoticeProcessor, it doesn't seem to be defined in the library.
Another issue that I am running into is that while the documentation
claims that PQnoticeReceivers may call PQnoticeProcessors, it doesn't
mention how this is to be done. How do I find out which PQnoticeProcessor
is connected to a PGresult?
I though that I could perhaps access it directly by including libpq-int.h,
but that seems to be missing from 7.4 now. (Should the note about not
using libpq-int.h in the documentation be removed now that it isn't there
anymore?)
- --
Jonathan Gardner
jgardner@jonathangardner.net
Live Free, Use Linux!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
iD8DBQFACkN1WgwF3QvpWNwRAnzxAKCHDTprHc0d7aC6gRzUleU6zgy59wCfe8/v
0E9jN6p+s8cceiBDUbc9wGE=
=gvi9
-----END PGP SIGNATURE-----
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: PQsetNoticeReceiver issues
@ 2004-01-18 10:19 Peter Eisentraut <peter_e@gmx.net>
parent: Jonathan Gardner <jgardner@jonathangardner.net>
0 siblings, 1 reply; 3+ messages in thread
From: Peter Eisentraut @ 2004-01-18 10:19 UTC (permalink / raw)
To: Jonathan Gardner <jgardner@jonathangardner.net>; pgsql-interfaces
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.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: PQsetNoticeReceiver issues
@ 2004-01-19 02:38 L J Bayuk <ljb220@mindspring.com>
parent: Peter Eisentraut <peter_e@gmx.net>
0 siblings, 0 replies; 3+ messages in thread
From: L J Bayuk @ 2004-01-19 02:38 UTC (permalink / raw)
To: peter_e@gmx.net; +Cc: jgardner@jonathangardner.net; pgsql-interfaces
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...
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2004-01-19 02:38 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-01-18 08:27 PQsetNoticeReceiver issues Jonathan Gardner <jgardner@jonathangardner.net>
2004-01-18 10:19 ` Peter Eisentraut <peter_e@gmx.net>
2004-01-19 02:38 ` L J Bayuk <ljb220@mindspring.com>
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