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

Re: [INTERFACES] facing problem with ecpg

From: hoelc <hoelc(at)pd(dot)jaring(dot)my>
To: Michael Meskes <Michael_Meskes(at)topmail(dot)de>
Cc: James Thompson <jamest(at)math(dot)ksu(dot)edu>, pgsql-interfaces(at)postgreSQL(dot)org
Subject: Re: [INTERFACES] facing problem with ecpg
Date: 1999-02-11 16:42:34
Message-ID: 36C3087A.CD315794@pd.jaring.my (view raw or flat)
Thread:
Lists: pgsql-interfaces
Hello,
I've just upgrated my PostgreSQL system to version Postgres-6.4.2
Now it has the *ecpg
But I'm facing problem in using it, when I compile the C program with
        cc -o tryecpg tryecpg.c -lecpg -lpq
the compiler can't recognize the " exec sql ", and give error massage
       Parse error before 'sql'

What went wrong ?  Please advise.
Thanks for giving me the address for the Oracle Pre*C/C++ programmer's guide, it
is a good reference.  But, it doesn't exactly reflect the ecpg, right?  Is there
any reference and example program for how to use ecpg?
Thank you very much.

Regards,
LCH

Michael Meskes wrote:

> On Sat, Feb 06, 1999 at 07:16:14PM -0600, James Thompson wrote:
> > http://www.dal.ca/%7eoracle/oradoc/DOC/api/doc/PC_22/toc.htm
>
> Gotta look at this.
>
> > With it you end up with something like the following in your code
> >
> >     exec sql
> >       insert into customer(id,name_first,name_middle,name_last,company,
> >                       address1,address2,city,state,country,zip,phone_work,
> >                       phone_home,phone_fax,email,date_entered,billing_terms,
> >                            confirmation_method)
> >       values (:id,:name_first, :name_middle, :name_last,
> >               :company,:address1,:address2,
> >               :city,:state,:country,:zip,:phone_work,
> >               :phone_home,:phone_fax,:email,date('now'),
> >               :billing_terms,
> >               :confirmation_method);
>
> Xou can even add indicators like in
>
> ... values (:id,:name_first, :name_middle:nm_ind, :name_last, ...
>
> If nm_ind is set to -1 the name_middle entry will be set to NULL.
>
> > The author of the code is very responsive to few problem reports I have
> > sent him and has sent patches, or workarounds to me usually within 24
> > hours.
>
> Glad I can help. :-)
>
> > In the few cases you can't figure out a way to make something happen using
> > ecpg I believe you can mix the libpg and ecpg code in the same program.
> > The only place I could see a need for this is when you'd need the
> > functionality given by Pro*C's Dynamic SQL which ecpg doesn't yet support,
> > but I think its in the works.
>
> It is. In fact I already submitted a patch for the PREPARE and EXECUTE
> commands. James, if you'd like to test this I can send you the source until
> it makes its way into CVS.
>
> Michael
> --
> Michael Meskes                         | Go SF 49ers!
> Th.-Heuss-Str. 61, D-41812 Erkelenz    | Go Rhein Fire!
> Tel.: (+49) 2431/72651                 | Use Debian GNU/Linux!
> Email: Michael(dot)Meskes(at)gmx(dot)net          | Use PostgreSQL!




In response to

Responses

pgsql-interfaces by date

Next:From: Alejandro Alberola AriasDate: 1999-02-11 19:36:06
Subject: JDBC: DatabaseMetaData and getPrimaryKeys
Previous:From: Dave PageDate: 1999-02-11 16:06:55
Subject: pgAdmin v6.4.2

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