Re: Stored procedures returning cursors

Поиск
Список
Период
Сортировка
От Daniele Varrazzo
Тема Re: Stored procedures returning cursors
Дата
Msg-id CA+mi_8YgDWTieGYJ2LmNLNkEZD4MsoO5gUHyKmmREhuFhDrfAg@mail.gmail.com
обсуждение исходный текст
Ответ на Stored procedures returning cursors  (Rodolfo Stangherlin <RStanghe@ucs.br>)
Список psycopg
On Tue, Dec 20, 2011 at 6:47 PM, Rodolfo Stangherlin <RStanghe@ucs.br> wrote:
> I was trying to call a procedure returning a "ref cursor" in a PostgreSQL
> database. It works with psycopg2 2.3.2, but not with 2.4.4.
>
> My code looks like this:
> http://osdir.com/ml/python.db.psycopg.devel/2005-10/msg00116.html
>
> The result is a "cursor <unnamed portal 1> doesn't exists"
> How I can do it in the right way?

You should give a name to the portal to make it work.

The example still works (I had to omit the quotes decorating the name
in Portal.__init__) but there is an easier technique to obtain the
same result: execute the function creating the (named) ref cursor,
then just create a named cursor to steal it. It has been discussed
recently in this list and there is an example in the documentation:
see <http://initd.org/psycopg/docs/usage.html#server-side-cursors> (in
the note box).

-- Daniele

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

Предыдущее
От: Rodolfo Stangherlin
Дата:
Сообщение: Stored procedures returning cursors
Следующее
От: Christopher David Howie
Дата:
Сообщение: Rows from a stored procedure result are stringified