X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 79CCD52A6C for ; Thu, 10 Mar 2005 21:51:17 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 72784-06 for ; Thu, 10 Mar 2005 21:51:07 +0000 (GMT) Received: from web53304.mail.yahoo.com (web53304.mail.yahoo.com [206.190.39.233]) by svr1.postgresql.org (Postfix) with SMTP id 54FB25656D for ; Thu, 10 Mar 2005 21:51:05 +0000 (GMT) Received: (qmail 77350 invoked by uid 60001); 10 Mar 2005 21:51:07 -0000 Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; b=0Yxf0lYZyAAwAdtu0xpHKHCXKn7QaPzuP3OoL8Q0MozrxY6UtEcQ619+hpmVJj3kUDzJiAQMKmBJLiTIXHl4c7bwiM8CshlpFY/PiFgVoJtGV4rHAhpglTZysXJLrl/Zt3n2uaHQPYc9OmjIQX6civKDeDw1zvMucUYbkRFjFvY= ; Message-ID: <20050310215107.77348.qmail@web53304.mail.yahoo.com> Received: from [204.27.176.5] by web53304.mail.yahoo.com via HTTP; Thu, 10 Mar 2005 13:51:07 PST Date: Thu, 10 Mar 2005 13:51:07 -0800 (PST) From: Mark Richardson Subject: ECPG - cursor fetch To: pgsql-interfaces@postgresql.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1833040143-1110491467=:77170" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.879 tagged_above=0 required=5 tests=DNS_FROM_RFC_ABUSE, HTML_20_30, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200503/33 X-Sequence-Number: 5362 --0-1833040143-1110491467=:77170 Content-Type: text/plain; charset=us-ascii 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! --0-1833040143-1110491467=:77170 Content-Type: text/html; charset=us-ascii
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! --0-1833040143-1110491467=:77170--