From: Mark Richardson <markmapo@yahoo.com>
To: pgsql-interfaces@postgresql.org
Subject: ECPG - cursor fetch
Date: Thu, 10 Mar 2005 13:51:07 -0800 (PST)
Message-ID: <20050310215107.77348.qmail@web53304.mail.yahoo.com> (raw)
I'm doing a port from Sybase's pre-compiler cpre, to ecpg and I have a couple of questions (if anyone has the time). This relates to cursors and fetching, and what I would like to do is retrieve a bunch of records at one time - cpre is able to fetch values into an array...
EXEC SQL BEGIN DECLARE SECTION;
int myInts[100];
EXEC SQL END DECLARE SECTION;
...
EXEC SQL DECLARE myCursor FOR SELECT
myInt FROM myTable;
EXEC SQL FETCH myCursor INTO
:myInts;
There is one mechanism that cpre uses to make sure that you don't exceed the array size...
EXEC SQL OPEN myCursor ROW_COUNT=100;
then, every time you do a fetch, it retrives 100 rows.
I'm not asking for this exact thing in ecpg, but what mechanisms are available for a similar type of response, rather than looping the fetch statement a bunch of times?
Also, since I'm in the middle of a port, I'm trying to make the code work for both with a different compile flag - but the pre-compilers don't care about #defines. Is there some other mecanism to tell ecpg to ignore or skip a section? I really don't want to have to make a "Pre-pre-compiler".
I thought I would share this - the ecpg pre-compiler is much easier to work with, and it handles things better than cpre when it comes to code generation. I think it would be much easier to port from ecpg to cpre than what I am doing, because a lot of the non-standard options that are available used/forced in cpre. So thanks for all the work you guys have done.
---------------------------------
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: markmapo@yahoo.com
Subject: Re: ECPG - cursor fetch
In-Reply-To: <20050310215107.77348.qmail@web53304.mail.yahoo.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox