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

Re: ECPG and typedef struct

From: Michael Meskes <meskes(at)postgresql(dot)org>
To: Edmund Bacon <ebacon(at)onesystem(dot)com>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: ECPG and typedef struct
Date: 2004-01-27 17:53:54
Message-ID: 20040127175354.GA2167@1 (view raw, whole thread or download thread mbox)
Lists: 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

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 Meskes
Email: Michael at Fam-Meskes dot De
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes(at)jabber(dot)org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!

In response to

pgsql-interfaces by date

Next:From: Daz DigglerDate: 2004-01-28 22:51:43
Subject: Pg Perl & libpq HP-UX
Previous:From: Michael MeskesDate: 2004-01-27 17:47:07
Subject: Re: ecpg with nested structure

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