Skip site navigation (1) Skip section navigation (2)

Re: ECPG include problem

From: Matthew Vanecek <mevanecek(at)yahoo(dot)com>
To: Mike Alford <mikea(at)syscon-intl(dot)com>
Cc: Postgresql Interfaces List <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: ECPG include problem
Date: 2003-02-21 02:23:29
Message-ID: 1045794208.27174.13.camel@reliant.home.pri (view raw or flat)
Thread:
Lists: pgsql-interfaces
On Wed, 2003-02-19 at 11:24, Mike Alford wrote:
> I am trying to compile an application developed on SCO Unix with an Ingres
> 1.2 database that uses embedded sql. I am having a problem with the
> included files. 
> This code appears in the embedded sql in Ingres:
> #include <db1.h>
> EXEC SQL INCLUDE SQLCA;
> EXEC SQL BEGIN DECLARE SECTION;
>     EXEC SQL INCLUDE '../include/db2.h';
> EXEC SQL END DECLARE SECTION;
> 
> The ../include/db2.h file contains lines like
> typedef char ComText_t[L_COM_TEXT];
> that are defined in db1.h
> #define L_COM_TEXT      21      /* Length of pvdef text com parameter.
>   */
> 
> In porting to psql I have 
> #include <db1.h>
> EXEC SQL INCLUDE sqlca;
> EXEC SQL BEGIN DECLARE SECTION;
>     EXEC SQL INCLUDE ../include/db2;
> EXEC SQL END DECLARE SECTION;
> but receive the error
> ../include/db2.h:28: ERROR: parse error at or near "L_COM_TEXT"
> If I change 
> typedef char ComText_t[L_COM_TEXT]; to 
> typedef char ComText_t[21]; /*value of L_COM_TEXT */ 
> everything is fine. Apparently the preprocessing that Ingres did is not
> happening in Postgres. There are over 2000 lines in db2.h, mostly with
> constants defined in db1.h. Is there something simple I am overlooking, or
> an option to epcg that could allow db2.h to be preprocessed before it is
> included?
> 
> I am a novice at postgres.

To the best of my knowledge, there is no such option.  You may want to
try running db2.h through cpp prior to running ecpg.  For best results,
you would not want any other headers included--just db1.h and db2.h.

-- 
Matthew Vanecek
perl -e 'print $i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);'
********************************************************************************
For 93 million miles, there is nothing between the sun and my shadow except me.
I'm always getting in the way of something...

In response to

pgsql-interfaces by date

Next:From: Matthew VanecekDate: 2003-02-21 03:14:26
Subject: Re: structured host variable arrays within ecpg
Previous:From: Nigel J. AndrewsDate: 2003-02-20 23:37:29
Subject: Re: Perl interfacing to old and new backends.

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group