Re: Return results for PQexec vs PQexecP*

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Return results for PQexec vs PQexecP*
Дата
Msg-id 20060517125305.GE15180@svana.org
обсуждение исходный текст
Ответ на Return results for PQexec vs PQexecP*  ("Greg Sabino Mullane" <greg@turnstep.com>)
Ответы Re: Return results for PQexec vs PQexecP*
Список pgsql-hackers
On Wed, May 17, 2006 at 12:45:17PM -0000, Greg Sabino Mullane wrote:
> Someone posted something on the DBD::Pg mailing list recently that
> made me wonder if the user's problem is more of a "don't do that"
> or something that may be solvable with a libpq or protocol change.
>
> Basically, the user has a rule which switches an insert to a select.
> They then want to run the insert, and pull the resulting tuples
> from it. This works fine when using PQexec, as it returns the latest
> result, which is PGRES_TUPLES_OK. However, when using the newer
> PQexec family (PQexecParams and PQexecPrepared), the only thing returned
> is PGRES_COMMAND_OK, which prevents the drawing of any subsequent tuples.

The main problem with PQexec and co is that they don't really do very
well if a single query produces multiple result sets. I'm not sure if
it's defined whether you get the first or the last. In any case, if you
want all the result sets, you need to be looking at PQsendquery and co.

Have a ncie day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

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

Предыдущее
От: "Greg Sabino Mullane"
Дата:
Сообщение: Return results for PQexec vs PQexecP*
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: pg_dump and backslash escapes