cursor error in libpq program

From: Duane Moore III <ddmoore(at)ncsa(dot)uiuc(dot)edu>
To: pgsql-general(at)postgresql(dot)org
Subject: cursor error in libpq program
Date: 1998-06-08 04:42:24
Message-ID: Pine.SOL.3.95.980607232604.15900A-100000@pecos.ncsa.uiuc.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


OK, I'm baffled. I have a CGI program that uses libpq/libpq++ to access a
postgres database. I recently started to use cursors, so I could cut down
on the memory requirements for the front-end. So, instead of doing
select * from table;
I implemented a cursor so I could move through the data like so
declare cursorname cursor for select * from table;

My CGI program allows the user to browse through the rows of the table, so
I have 'previous page', 'next page' links up at the top of the page. The
only problem is that I can not use the 'MOVE' command to move the cursor
correctly (which defeats the whole point of cursors!) My program works
fine when I do the following via PgCursor in libpq++. (The examples are
changed from my actual table names.)

begin
declare FOO cursor for select * from table;
fetch forward 20 in FOO;
close FOO;
end

but when I try to do this:

begin
declare FOO cursor for select * from table;
move forward 20 in FOO;
fetch forward 20 in FOO;
close FOO;
end

I get the following error after the FETCH command:

NOTICE: (transaction aborted): queries ignored until END

The same sequence of commands work when I enter them manually in psql.
Does anyone have a clue why adding the 'move' command should give me this
problem? Any help would be appreciated. Please include a reply to my
email address (ddmoore(at)ncsa(dot)uiuc(dot)edu) because I am not yet subscribed to
this list.

Thanks,
Duane Moore
ddmoore(at)ncsa(dot)uiuc(dot)edu

PS: Does anyone know if these new lists are being archived on the web like
the old ones? I found the ftp archive, but it is not nearly as convenient
as the mhonarc archives.

Browse pgsql-general by date

  From Date Subject
Next Message Herouth Maoz 1998-06-08 07:44:42 Re: [GENERAL] Should I run regression tests?
Previous Message Bruce Momjian 1998-06-08 04:34:09 Re: [GENERAL] Should I run regression tests?