Re: ECPG: How to use #define and string host variable - Mailing list pgsql-interfaces

From Michael Meskes
Subject Re: ECPG: How to use #define and string host variable
Date
Msg-id 20020104130517.GC7948@feivel.credativ.de
Whole thread Raw
In response to ECPG: How to use #define and string host variable  (reply2nelson@yahoo.com (Nelson))
List pgsql-interfaces
On Wed, Jan 02, 2002 at 10:22:59AM -0800, Nelson wrote:
> ERROR: parse error, expecting `CVARIABLE' or `ICONST' or `']'' or `'('
> ' at or near "MAX"
> 
> #define MAX 10
> 
> EXEC SQL BEGIN DECLARE SECTION;
>    char t[MAX];
> EXEC SQL END DECLARE SECTION;
> 
> How do I make the precompiler see the define?

Just use 

EXEC SQL DEFINE MAX 10;

EXEC SQL BEGIN DECLARE SECTION;
char t[MAX];
EXEC SQL END DECLARE SECTION;

ECPG only parses statements beginning with EXEC SQL.

Michael
-- 
Michael Meskes
Michael@Fam-Meskes.De
Go SF 49ers! Go Rhein Fire!
Use Debian GNU/Linux! Use PostgreSQL!


pgsql-interfaces by date:

Previous
From: Daniel Andersen
Date:
Subject: libpq doing strange things
Next
From: lee
Date:
Subject: