Re: migration: parameterized statement and cursor

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Aleksey Onopriyenko <aleksey(dot)alt(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: migration: parameterized statement and cursor
Date: 2010-01-12 06:47:34
Message-ID: 162867791001112247s6879b624le3705f125f3357d9@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2010/1/11 Aleksey Onopriyenko <aleksey(dot)alt(at)gmail(dot)com>:
> Hello.
>
> We are trying to migrate from Informix 9.4 to PostgreSQL. As part of
> migration we are porting our client application.
>
> So we need reimplement such functionality:
> 1. Declare a cursor using to _parameterized_ SELECT statement. It should be
> possible to specify cursor's name (and, perhaps, the statement) dynamically.

cursors are supported, but parametrised cursors are supported only
inside plpgsql. Maybe you can transform your code to plpgsql function.
http://www.postgresql.org/docs/8.4/interactive/plpgsql-cursors.html

> 2. Open that cursor (in another C-function) passing parameters to it.

only in plpgsql

> 3. Fetch records from result set.

yes

Regards
Pavel Stehule

> 4. Close the cursor.
>
> Steps 2-4 may be repeated if necessary.
>
> Is it possible with ecpg or libpq?
>

> ----
> Best regards,
> Aleksey
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Yan Cheng Cheok 2010-01-12 06:53:09 Re: Best Practice when Encounter Invalid Stored Procedure Parameters
Previous Message Leigh Dyer 2010-01-12 06:39:12 Backup strategies with significant bytea data