Received: from pc63.meskes.de (root@as14-039.rp-plus.de [149.221.92.39]) by hub.org (8.9.2/8.9.1) with ESMTP id NAA34420 for ; Sat, 20 Feb 1999 13:12:42 -0500 (EST) (envelope-from Michael.Meskes@gmx.net) Received: (from meskes@localhost) by pc63.meskes.de (8.9.3/8.9.3/Debian/GNU) id RAA00729 for pgsql-interfaces@postgreSQL.org; Sat, 20 Feb 1999 17:52:58 +0100 Date: Sat, 20 Feb 1999 17:52:58 +0100 From: Michael Meskes To: pgsql-interfaces@postgreSQL.org Subject: Re: [INTERFACES] ecpg: use of #defines Message-ID: <19990220175258.A687@gmx.net> Mail-Followup-To: pgsql-interfaces@postgreSQL.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.1i In-Reply-To: ; from James Thompson on Sat, Feb 20, 1999 at 10:22:09AM -0600 On Sat, Feb 20, 1999 at 10:22:09AM -0600, James Thompson wrote: > In my exec sql begin declare section i have items like > > char uid_result[31]; > > which I tried to replace last night with > char uid_result[UID_LEN]; > > and I placed #define UID_LEN 31 in a .h file #define is only parsed by cpp not by ecpg. > I changed my #include with a exec sql include to include the .h file > > The parser didn't like the char uid_result[UID_LEN] line > > I'm pretty sure I understand the mechanics of this, cpp hasn't run and > UID_LEN is an invalid value. Try 'exec sql define UID_LEN 31;' > Is there a workaround? Other than hard coding the 31 No need to work around this as the functionality is already there. Please see test1.pgc for an example. Yes, I know I should document all this. :-) Note, that using the exec sql define command is sufficient. You do not need a #define anymore since ecpg will make the replacement. Michael -- Michael Meskes | Go SF 49ers! Th.-Heuss-Str. 61, D-41812 Erkelenz | Go Rhein Fire! Tel.: (+49) 2431/72651 | Use Debian GNU/Linux! Email: Michael.Meskes@gmx.net | Use PostgreSQL!