Re: Returning multiple result sets

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Returning multiple result sets
Дата
Msg-id 20051120140717.GA32031@svana.org
обсуждение исходный текст
Ответ на Re: Returning multiple result sets  (Alvaro Herrera <alvherre@commandprompt.com>)
Ответы Re: Returning multiple result sets  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Sat, Nov 19, 2005 at 08:02:08PM -0300, Alvaro Herrera wrote:
> Hmm -- probably we could declare that the current libpq API will not
> support multiple result sets from one query, and return only the first
> one to the application discarding the rest.  (It just occured to me --
> what happens if one send multiple SELECTs in a semicolon-separated query
> via libpq?).  New apps wanting to take advantage of the new
> functionality would need to invoke a different function.

libpq supports it just fine. You do a PQsendQuery() and then as many
PQgetResult()s as it takes to get back the results. This worked for a
while AFAIK.

> At the protocol level this will need an extension anyway, so clients
> using the protocol directly would need to be updated to understand
> multiple results.

The protocol supports it fine. If the server sends a new 'T' record,
libpq assumes it's returning a new resultset. When the server sends a
"ready for query" message, libpq knows that the last resultset has
arrived.

It's the backend that needs work, not the protocol.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

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

Предыдущее
От: Simon Riggs
Дата:
Сообщение: Re: Virtual tuple slots versus TOAST: big problem
Следующее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: Returning multiple result sets