Re: libpq object hooks - Mailing list pgsql-patches

From Merlin Moncure
Subject Re: libpq object hooks
Date
Msg-id b42b73150805140806n1d6be079kf9dcf5a6066453e0@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:
> No, they could revise their patch to be more stylistically in keeping
> with libpq.  I haven't looked at the current version of the patch yet,
> but the early versions seemed quite overengineered to me, so your
> criticism didn't surprise me.

I think you'll find the latest version more reasonable.  We tried to
keep the over-engineering, so to speak, on our side and make the libpq
changes surgical.

> 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.

Here are the proposed API changes [aside: this is one of two breaks
from your initial suggestions..the other being PQcopyResult]:

+ PQcopyResult              142
+ PQsetvalue                143
+ PQresultAlloc             144
+ PQaddObjectHooks          145
+ PQaddGlobalObjectHooks    146
+ PQhookData                147
+ PQresultHookData          148

In question is:
+ void *
+ PQhookData(const PGconn *conn, const char *hookName)

Basically, libpqtypes has various functions that take a PGconn that
need the private data that is stored in libpq with the connection.
PQhookData just does simple linear search and returns the data.

[thinks]
are you suggesting something like
+ void *
+ PQhookData(const PGconn *conn, const void *hookHandle)
?

I would have to take a quick look at the code with Andrew C (he'll be
in in a bit)...but this might be doable.

merlin

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: libpq object hooks
Next
From: "Merlin Moncure"
Date:
Subject: Re: libpq object hooks