Re: libpq object hooks - Mailing list pgsql-patches

From Merlin Moncure
Subject Re: libpq object hooks
Date
Msg-id b42b73150805150852m7b3c28fai2d7a4497c84118b2@mail.gmail.com
Whole thread Raw
In response to Re: libpq object hooks  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: libpq object hooks
List pgsql-patches
On Wed, May 14, 2008 at 10:44 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> I'm wondering why the hooks need names at all.  AFAICS all that
> libpq needs to know about a hook is a callback function address
> and a void * passthrough pointer.

I'm trying to make this work as you suggest.

It's pretty clear that all the callbacks should be modified to send a
void* along with the other arguments.  This would eliminate the need
for hookname there (getting the state inside callback functions).

The problem is the functions PQhookData(conn, hookname) and
PQresultHookData(result, hookName).  We need these to work in
functions that are not callbacks.  If we eliminate hookname
completely, there is no way for libpq to know which private state we
are asking for.  I'm a little bit stuck here.  Is it possible to
preserve the hookname outside of the context of the callback functions
or is there something else I'm missing? (I'm sorry if I'm being
obtuse)

Eliminating the need for libpqtypes to need PQhookx functions, while
possible, would make libpqtypes a lot more difficult to use and
generally more awkward.

merlin

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Patch to change psql default banner v6
Next
From: Andrew Dunstan
Date:
Subject: Re: Patch to change psql default banner v6