pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
ECPG include problem
5+ messages / 4 participants
[nested] [flat]

* ECPG include problem
@ 2003-02-19 17:24 Mike Alford <mikea@syscon-intl.com>
  2003-02-21 02:23 ` Re: ECPG include problem Matthew Vanecek <mevanecek@yahoo.com>
  2003-02-21 07:14 ` Re: ECPG include problem Michael Meskes <meskes@postgresql.org>
  0 siblings, 2 replies; 5+ messages in thread

From: Mike Alford @ 2003-02-19 17:24 UTC (permalink / raw)
  To: pgsql-interfaces

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.
Do not try to solve all life's problems at once -- learn to dread each
day as it comes.




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: ECPG include problem
  2003-02-19 17:24 ECPG include problem Mike Alford <mikea@syscon-intl.com>
@ 2003-02-21 02:23 ` Matthew Vanecek <mevanecek@yahoo.com>
  1 sibling, 0 replies; 5+ messages in thread

From: Matthew Vanecek @ 2003-02-21 02:23 UTC (permalink / raw)
  To: Mike Alford <mikea@syscon-intl.com>; +Cc: 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...

Attachments:

  signature.asc (application/pgp-signature, 231B) download

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: ECPG include problem
  2003-02-19 17:24 ECPG include problem Mike Alford <mikea@syscon-intl.com>
@ 2003-02-21 07:14 ` Michael Meskes <meskes@postgresql.org>
  1 sibling, 0 replies; 5+ messages in thread

From: Michael Meskes @ 2003-02-21 07:14 UTC (permalink / raw)
  To: Mike Alford <mikea@syscon-intl.com>; +Cc: pgsql-interfaces

On Wed, Feb 19, 2003 at 05:24:45PM +0000, Mike Alford wrote:
> 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?

Ingres preprocessor does parse C and CPP code as well, ecpg does not. It
only parses stuff after an exec sql keyword is found. The only way for
you get this going is to use "exec sql define" instead of "#define" as
the former is parsed an honored by ecpg. Of course you could as well try
running cpp over the files before but that won't always work.

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



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: ECPG include problem
@ 2003-02-24 10:26 Christoph Haller <ch@rodos.fzk.de>
  2003-02-24 15:26 ` Re: ECPG include problem Michael Meskes <meskes@postgresql.org>
  0 siblings, 1 reply; 5+ messages in thread

From: Christoph Haller @ 2003-02-24 10:26 UTC (permalink / raw)
  To: pgsql-interfaces; +Cc: meskes@postgresql.org

>
> Ingres preprocessor does parse C and CPP code as well, ecpg does not.
It
> only parses stuff after an exec sql keyword is found. The only way for

> you get this going is to use "exec sql define" instead of "#define" as

> the former is parsed an honored by ecpg. Of course you could as well
try
> running cpp over the files before but that won't always work.
>
Looks like a lack of documentation. Maybe I am wrong, but I could not
find anything about the existence of "exec sql define".

Regards, Christoph





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: ECPG include problem
  2003-02-24 10:26 Re: ECPG include problem Christoph Haller <ch@rodos.fzk.de>
@ 2003-02-24 15:26 ` Michael Meskes <meskes@postgresql.org>
  0 siblings, 0 replies; 5+ messages in thread

From: Michael Meskes @ 2003-02-24 15:26 UTC (permalink / raw)
  To: Christoph Haller <ch@rodos.fzk.de>; +Cc: pgsql-interfaces; meskes@postgresql.org

On Mon, Feb 24, 2003 at 11:26:39AM +0100, Christoph Haller wrote:
> Looks like a lack of documentation. Maybe I am wrong, but I could not
> find anything about the existence of "exec sql define".

That may very well be the case. The docu is lacking for quite some time,
but no one volunteered so far resp. those who did also lost their time
in between.

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



^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2003-02-24 15:26 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-02-19 17:24 ECPG include problem Mike Alford <mikea@syscon-intl.com>
2003-02-21 02:23 ` Matthew Vanecek <mevanecek@yahoo.com>
2003-02-21 07:14 ` Michael Meskes <meskes@postgresql.org>
2003-02-24 10:26 Re: ECPG include problem Christoph Haller <ch@rodos.fzk.de>
2003-02-24 15:26 ` Michael Meskes <meskes@postgresql.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox