Re: libpq object hooks

Поиск
Список
Период
Сортировка
От Andrew Chernow
Тема Re: libpq object hooks
Дата
Msg-id 482C7B8E.9050709@esilo.com
обсуждение исходный текст
Ответ на Re: libpq object hooks  (Andrew Dunstan <andrew@dunslane.net>)
Список pgsql-patches
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/

В списке pgsql-patches по дате отправления:

Предыдущее
От: Andrew Chernow
Дата:
Сообщение: Re: libpq object hooks
Следующее
От: Tom Lane
Дата:
Сообщение: Re: libpq object hooks