Re: libpq object hooks - Mailing list pgsql-patches

From Tom Lane
Subject Re: libpq object hooks
Date
Msg-id 6044.1210867771@sss.pgh.pa.us
Whole thread Raw
In response to Re: libpq object hooks  ("Merlin Moncure" <mmoncure@gmail.com>)
Responses Re: libpq object hooks
Re: libpq object hooks
List pgsql-patches
"Merlin Moncure" <mmoncure@gmail.com> writes:
> 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.

Well, depending on a hook name for this is broken-by-design anyway,
because there is no way for two independently written libraries to
be sure they don't choose conflicting hook names.  So the need for
a hook name has to go away.

It might work to use the address of the hook callback function as
a key for retrieving the associated void * pointer.  You'd need to
not register the same callback function more than once per object,
but from what I gather here you don't need to.

            regards, tom lane

pgsql-patches by date:

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