pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Meskes <meskes@postgresql.org>
To: Daniel Kelley <dkelley@otec.com>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: ecpg & host variables
Date: Sat, 20 Jul 2002 13:45:28 +0200
Message-ID: <20020720114528.GE1781@feivel.fam-meskes.de> (raw)
In-Reply-To: <Pine.BSF.4.20L2.0207191555500.34939-100000@mx1.gc.ny.otec.com>
References: <Pine.BSF.4.20L2.0207191555500.34939-100000@mx1.gc.ny.otec.com>

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!



view thread (3+ messages)

Message-ID: <20020720114528.GE1781@feivel.fam-meskes.de>
Permalink:  ../20020720114528.GE1781@feivel.fam-meskes.de/
Also on:    postgresql.org/message-id/20020720114528.GE1781@feivel.fam-meskes.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: meskes@postgresql.org, dkelley@otec.com
  Subject: Re: ecpg & host variables
  In-Reply-To: <20020720114528.GE1781@feivel.fam-meskes.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox