Re: libpq object hooks

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: libpq object hooks
Дата
Msg-id b42b73150805150852m7b3c28fai2d7a4497c84118b2@mail.gmail.com
обсуждение исходный текст
Ответ на Re: libpq object hooks  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: libpq object hooks  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Patch to change psql default banner v6
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: Patch to change psql default banner v6