Re: libpq object hooks - Mailing list pgsql-patches

From Tom Lane
Subject Re: libpq object hooks
Date
Msg-id 9867.1210877054@sss.pgh.pa.us
Whole thread Raw
In response to Re: libpq object hooks  (Andrew Chernow <ac@esilo.com>)
Responses Re: libpq object hooks
Re: libpq object hooks
List pgsql-patches
Andrew Chernow <ac@esilo.com> writes:
> Which callback do we use as the key?  Currently, none are required (only
> the name was required).  We have to choose one callback that must be
> provided.

What?  I thought what you wanted back was the void * pointer that had
been registered with a particular callback function.  So you use that
callback function.  If it's not actually registered, you get a NULL.

> This is what is passed to PQaddObjectHooks, along with a conn:

This is all wrong IMHO, not least because it creates ABI problems if you
want to add another hook type later.  Register each hook separately, eg

typedef void (*PGCRHook) (PGconn *conn, void *passthrough);

void PQregisterConnResetHook(PGconn *conn, PQCRHook func, void *passthrough);

... repeat for each possible hook ...

            regards, tom lane

pgsql-patches by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Patch to change psql default banner v6
Next
From: pgsql@mohawksoft.com
Date:
Subject: SSL client configuration patch