Re: ECPG and typedef struct - Mailing list pgsql-interfaces

From Michael Meskes
Subject Re: ECPG and typedef struct
Date
Msg-id 20040127175354.GA2167@1
Whole thread Raw
In response to ECPG and typedef struct  (Edmund Bacon <ebacon@onesystem.com>)
List pgsql-interfaces
On Mon, Jan 19, 2004 at 11:31:36AM -0700, Edmund Bacon wrote:
> Is it still necessary to define SQL TYPEs twice?

It depends, but teh way you ask, yes.

> Is there some less maintenance-error-prone way to accomplish this?  I
> know about the -c option to ecpg, but this doesn't help if I need to
> access the defined type from a .c file.

Why? Can't you just put it into a header file that is processed by ecpg
to create a C header and use "-c" for this? Okay, this does include the
ecpg headers also, but if that's the problem we could add an option
easily.

How about an option "parsing header file"?

> Ideally the C level typedef would be in a .h file somewhere and either
> #include-ed or EXEC SQL INCLUDE-ed into .c or .pgc file

Would it be okay to do this:

Write a *.pgh file, that is SQL-INCLUDE-ed in embedded sql files. For C
you'd call "ecpg -h" on that file, making ecpg produce a .h file, that
can be included by your C code.

Hmm, I think I'm going to implement that immediately. :-)

Michael

-- 
Michael Meskes
Email: Michael at Fam-Meskes dot De
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!


pgsql-interfaces by date:

Previous
From: Michael Meskes
Date:
Subject: Re: ecpg with nested structure
Next
From: "Jeroen T. Vermeulen"
Date:
Subject: libpq notice processors