Re: using server side cursor

Поиск
Список
Период
Сортировка
От Daniele Varrazzo
Тема Re: using server side cursor
Дата
Msg-id CA+mi_8YtcXc235ZC9rHz4X5tGWM2B-WurBtxo5mdA+9AcoXKgQ@mail.gmail.com
обсуждение исходный текст
Ответ на using server side cursor  (thomas veymont <thomas.veymont@gmail.com>)
Список psycopg
On Fri, Oct 14, 2011 at 11:32 AM, thomas veymont
<thomas.veymont@gmail.com> wrote:

> mycursor.execute ( "fetch", [ "mycursor" ] ) # fetch row from this cursor
> mycursor.fetchone()

This is the only error you have made: there is no placeholder in the
query. And even if there was, it would be an error as it would result
in something like "fetch 'mycursor' ", and postgres doesn't want the
quotes.

mycursor.execute ( "fetch mycursor" ) would do what you were
expecting. If you have to compose the command, you have no protection
though, so you should be hypercareful about where "mycursor" comes
from.

Federico is right though that using the plain query with a psycopg
named cursor makes things easier.

-- Daniele

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

Предыдущее
От: Federico Di Gregorio
Дата:
Сообщение: Re: using server side cursor
Следующее
От: Daniele Varrazzo
Дата:
Сообщение: Re: using server side cursor