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

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 (view raw or flat)
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

pgsql-interfaces by date

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

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