USE OF CURSORS IN ECPG

From: "Maurizio" <maurizio(at)dreamtech-it(dot)com>
To: <pgsql-interfaces(at)postgresql(dot)org>
Subject: USE OF CURSORS IN ECPG
Date: 2000-11-07 16:52:00
Message-ID: 001101c048db$38a74d60$7394fea9@maurizio
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-interfaces

Hi,
I'm just starded using ecpg and I have some problem with cursors.

I wrote this lines

exec sql begin declare section;
char query[500];
int CodImpianto;
int Cod1;
int Cod2;
char Descr[100];
exec sql end declare section;
strcpy(query, "select ............");

exec sql connect db;

sub1()
{
exec sql prepare stmtunimpianto from :query;
exec sql declare CUR_UNIMPIANTO cursor for stmtunimpianto;
.
.
.

exec sql open CUR_UNIMPIANTO using :CodImpianto;
exec sql fetch CUR_UNIMPIANTO into :CodImpianto, :Descr;
.
.

exec sql close CUR_UNIMPIANTO;
exec sql execute StmtUpdImpianti using :Cod1, :Descr, :Cod2;
exec sql commit;
}

I call this routine a lot of time.
If I rem the commit all works fine but if I execute the commit the cursor was deleted and I receive some errors.

At open cursor : sqlca.sqlcode = -230 Invalid statement namei in line ......
at fetch : NOTICE : PerformPortalFetch: portal "cur_unimpianto" not found

Please could anyone help me ?

thanks

regards
Maurizio Cauci
DREAMTECH di Cauci Maurizio
Via Ronchetti, 2 - 21013 Gallarate (VA)
www.dreamtech-it.com

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hiroshi Inoue 2000-11-07 16:55:05 RE: refcnt leak ?
Previous Message Zeugswetter Andreas SB 2000-11-07 16:48:47 AW: Issue NOTICE for attempt to raise lock level?

Browse pgsql-interfaces by date

  From Date Subject
Next Message Will Dennis 2000-11-07 20:36:23 PoPy make error
Previous Message Christopher R. Jones 2000-11-07 14:47:35 Re: Access 2000 and empty fields