fetch in embedded sql - Mailing list pgsql-general

From Heinrich Retzlaw
Subject fetch in embedded sql
Date
Msg-id 9efmu2$3rl$1@news.tht.net
Whole thread Raw
List pgsql-general
hello,
i have written the following method for c++

bool DB::getPresentations(Presentations &pr)
{
        exec sql begin declare section;
                int     rID;
                char    pre[20];
        exec sql end declare section;

        rID = pr.roomID;

        exec sql BEGIN TRANSACTION;
        exec sql        DECLARE cur CURSOR FOR
                        SELECT  Presantation
                        FROM    Presantations
                        WHERE   RoomID=:rID;

        exec sql OPEN cur;

        // here
        exec sql FETCH FORWARD 1 IN cur INTO :pre;

        // and here
        exec sql CLOSE cur;
        exec sql COMMIT TRANSACTION;
}

if i start this method i get the following error belonging to the comments
"here" and "and here" in the code above

NOTICE:  current transaction is aborted, queries ignored until end of
transaction block
NOTICE:  current transaction is aborted, queries ignored until end of
transaction block

if i do the begin, declare cursor and fetch statement manually in the psql
database there is no error
thanks for every answer
best regards heinrich retzlaw



pgsql-general by date:

Previous
From: Mayan
Date:
Subject: Help with C++
Next
From: alla@sergey.com (Alla)
Date:
Subject: Return cursor