Andrew Dunstan wrote:



Tom Lane wrote:

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.


Or else have the library return a unique handle when registering hooks, rather than supplying a hook name.

cheers

andrew



The problem with this is that hooks can be registered on a per-conn basis. Is there a way to ensure the libpq returned handle would be the unique across every registration of a given PGobjectHooks? ISTM that the hook handle needs to be constant and unique somehow. Tom's idea would work with the "very" small limitation of not being able to reuse hook callbacks. I throw out an idea of using the address of a static, which is constant and unique.

app_func(PGresult *res)
{
  PQresultHookData(res, ?handle?);
}

app_func is not aware of what PGconn generated the result so it has no idea what libpq returned handle to use.

--
Andrew Chernow
eSilo, LLC
every bit counts
http://www.esilo.com/

--
Sent via pgsql-patches mailing list (pgsql-patches@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches

Reply via email to