Re: ECPG: How to use #define and string host variable

From: Michael Meskes <meskes(at)postgresql(dot)org>
To: Nelson <reply2nelson(at)yahoo(dot)com>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: ECPG: How to use #define and string host variable
Date: 2002-01-04 13:05:17
Message-ID: 20020104130517.GC7948@feivel.credativ.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)Fam-Meskes(dot)De
Go SF 49ers! Go Rhein Fire!
Use Debian GNU/Linux! Use PostgreSQL!

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message lee 2002-01-06 07:27:17
Previous Message Daniel Andersen 2002-01-03 23:30:21 libpq doing strange things