Re: PostgreSQL 8.3, libpq and WHERE CURRENT OF
От | Sebastien FLAESCH |
---|---|
Тема | Re: PostgreSQL 8.3, libpq and WHERE CURRENT OF |
Дата | |
Msg-id | 4721EA65.2050806@4js.com обсуждение исходный текст |
Ответ на | Re: PostgreSQL 8.3, libpq and WHERE CURRENT OF (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-hackers |
Tom Lane wrote: > Sebastien FLAESCH <sf@4js.com> writes: >> Does a simple PQPrepare() with a SELECT statement not create a cursor on >> the server side? > > No. A prepared statement is just a query plan, not a query-in-progress. Yes of course, I meant PQprepare() + PQexecPrepared() ... > > The Bind/Execute messages sent by PQexecPrepared create something akin > to a cursor, but libpq doesn't expose any API for fetching one row at a > time in that context, so there's no way to use the "current row" anyway. OK... that makes total sense (sorry I jump from one database to another and sometimes I forget implementation details of a specific driver). Sounds like I need to rework my driver to enable row by row fetching with the DECLARE CURSOR + FETCH commands... right? As I wrote: I knew these commands before, but for some reason I did not use that solution because I faced problems. I started with PostgreSQL 7.1 so maybe there was some limitation that does no more exist in 8.x ... Maybe it was because there is not real OPEN command, so you can't distinguish the preparation phase from the execution phase with the DECLARE CURSOR instruction... Or maybe because cursors could only exist inside a transaction block? Just found this in the 7.1 doc: http://www.postgresql.org/docs/7.1/static/sql-declare.html " ERROR: DECLARE CURSOR may only be used in begin/end transaction blocks This error occurs if the cursor is not declared within a transaction block. " Anyway... Thanks a lot guys for these quick answers. That changes from Oracle or SQL Server support. Seb
В списке pgsql-hackers по дате отправления: