Received: from pintail.mail.pas.earthlink.net (pintail.mail.pas.earthlink.net [207.217.120.122]) by postgresql.org (Postfix) with ESMTP id E17FB475AEC for ; Mon, 29 Jul 2002 18:28:52 -0400 (EDT) Received: from user-vcaumh5.dsl.mindspring.com ([216.175.90.37] helo=software1.logiplex.internal) by pintail.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) id 17ZJ0Y-0001J9-00 for pgsql-interfaces@postgresql.org; Mon, 29 Jul 2002 15:28:55 -0700 Subject: ECPG and dynamic SQL From: Cliff Wells To: pgsql-interfaces Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 Date: 29 Jul 2002 15:23:30 -0700 Message-Id: <1027981411.2433.30.camel@software1.logiplex.internal> Mime-Version: 1.0 X-Archive-Number: 200207/133 X-Sequence-Number: 2942 I'm porting an application from a proprietary database format to PostgreSQL using ECPG. My problem is that the application uses a single function to get a record from the database. Based upon which table is being accessed, it dynamically calculates column sizes and returns the record in a structure. Creating the query itself is fairly straightforward, but I am unable to figure out how to retrieve the _results_ of the query as I have no place to store them (since I don't know what they will be until the function is called I can't use a EXEC SQL DECLARE section). It seems Oracle's sqlda would be a possible solution, but I understand that isn't implemented in PostgreSQL. What is the best way to store the results of a dynamic query without knowing what the results will be beforehand (using ECPG, if possible)? I'm using PostgreSQL 7.2.1 on SCO OpenSwerver. -- Cliff Wells, Software Engineer Logiplex Corporation (www.logiplex.net) (503) 978-6726 x308 (800) 735-0555 x308