Re: libpq object hooks

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: libpq object hooks
Дата
Msg-id 482C7778.40707@dunslane.net
обсуждение исходный текст
Ответ на Re: libpq object hooks  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: libpq object hooks  (Andrew Chernow <ac@esilo.com>)
Re: libpq object hooks  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-patches

Tom Lane wrote:
> "Merlin Moncure" <mmoncure@gmail.com> writes:
>
>> 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.
>>
>
> Well, depending on a hook name for this is broken-by-design anyway,
> because there is no way for two independently written libraries to
> be sure they don't choose conflicting hook names.  So the need for
> a hook name has to go away.
>
> 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

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

Предыдущее
От: Ron Mayer
Дата:
Сообщение: Re: Patch to change psql default banner v6
Следующее
От: Andrew Chernow
Дата:
Сообщение: Re: libpq object hooks