pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
ecpg: use of #defines
2+ messages / 2 participants
[nested] [flat]

* ecpg: use of #defines
@ 1999-02-20 16:22  James Thompson <jamest@math.ksu.edu>
  0 siblings, 1 reply; 2+ messages in thread

From: James Thompson @ 1999-02-20 16:22 UTC (permalink / raw)
  To: pgsql-interfaces



Hello, 



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

  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.

Is there a workaround?  Other than hard coding the 31

Thanks

->->->->->->->->->->->->->->->->->->---<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<
James Thompson    138 Cardwell Hall  Manhattan, Ks   66506    785-532-0561 
Kansas State University                          Department of Mathematics
->->->->->->->->->->->->->->->->->->---<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<-<





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

* Re: [INTERFACES] ecpg: use of #defines
@ 1999-02-20 16:52  Michael Meskes <Michael_Meskes@topmail.de>
  parent: James Thompson <jamest@math.ksu.edu>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Meskes @ 1999-02-20 16:52 UTC (permalink / raw)
  To: pgsql-interfaces

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!



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


end of thread, other threads:[~1999-02-20 16:52 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-02-20 16:22 ecpg: use of #defines James Thompson <jamest@math.ksu.edu>
1999-02-20 16:52 ` Michael Meskes <Michael_Meskes@topmail.de>

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