USE OF CURSORS IN ECPG - Mailing list pgsql-interfaces

From Maurizio
Subject USE OF CURSORS IN ECPG
Date
Msg-id 001101c048db$38a74d60$7394fea9@maurizio
Whole thread Raw
Responses Re: USE OF CURSORS IN ECPG
List 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

pgsql-interfaces by date:

Previous
From: "Christopher R. Jones"
Date:
Subject: Re: Access 2000 and empty fields
Next
From: Will Dennis
Date:
Subject: PoPy make error