Re: ecpg & host variables - Mailing list pgsql-interfaces

From Michael Meskes
Subject Re: ecpg & host variables
Date
Msg-id 20020720114528.GE1781@feivel.fam-meskes.de
Whole thread Raw
In response to ecpg & host variables  (Daniel Kelley <dkelley@otec.com>)
List 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@Fam-Meskes.De
Go SF 49ers! Go Rhein Fire!
Use Debian GNU/Linux! Use PostgreSQL!


pgsql-interfaces by date:

Previous
From: Tom Lane
Date:
Subject: Re: ecpg & host variables
Next
From: "John L. Turner"
Date:
Subject: module object has no attribute ISO