Re: ecpg & host variables

From: Michael Meskes <meskes(at)postgresql(dot)org>
To: Daniel Kelley <dkelley(at)otec(dot)com>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: ecpg & host variables
Date: 2002-07-20 11:45:28
Message-ID: 20020720114528.GE1781@feivel.fam-meskes.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

On Fri, Jul 19, 2002 at 05:02:53PM -0400, Daniel Kelley wrote:
> EXEC SQL BEGIN DECLARE SECTION;
> typedef struct {
> int id;
> char name[30];
> char dsc[1000];
> } rec_t;
>
> rec_t r;
> EXEC SQL END DECLARE SECTION;

Actually this will not work, but you can do the following:

EXEC SQL BEGIN DECLARE SECTION;
struct {
int id;
char name[30];
char dsc[1000];
} r;
EXEC SQL END DECLARE SECTION;

or use the EXEC SQL TYPE command to do a typedef so ecpg knows about it:

EXEC SQL TYPE rec_r is struct {
int id;
char name[30];
char dsc[1000];
}

> is there are facility that i might be missing that would allow me to use
> our existing structures as host variables w/ postgres embedded sql? or am
> i better off just skipping ecpg and coding directly with libpq?

That will be much more work. ecpg was modelled in a way that pro*c apps
should compile without much of a problem.

Michael
--
Michael Meskes
Michael(at)Fam-Meskes(dot)De
Go SF 49ers! Go Rhein Fire!
Use Debian GNU/Linux! Use PostgreSQL!

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message John L. Turner 2002-07-20 12:21:43 module object has no attribute ISO
Previous Message Tom Lane 2002-07-19 21:24:28 Re: ecpg & host variables