Re: libpq object hooks

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: libpq object hooks
Дата
Msg-id 6044.1210867771@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: libpq object hooks  ("Merlin Moncure" <mmoncure@gmail.com>)
Ответы Re: libpq object hooks  (Andrew Dunstan <andrew@dunslane.net>)
Re: libpq object hooks  (Andrew Chernow <ac@esilo.com>)
Список pgsql-patches
"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.

            regards, tom lane

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

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