pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feedRe: [INTERFACES] facing problem with ecpg
7+ messages / 4 participants
[nested] [flat]
* Re: [INTERFACES] facing problem with ecpg
@ 1999-02-11 16:42 hoelc <hoelc@pd.jaring.my>
1999-02-11 19:51 ` Re: [INTERFACES] facing problem with ecpg Michael Meskes <Michael.Meskes@gmx.net>
0 siblings, 1 reply; 7+ messages in thread
From: hoelc @ 1999-02-11 16:42 UTC (permalink / raw)
To: Michael Meskes <Michael_Meskes@topmail.de>; +Cc: James Thompson <jamest@math.ksu.edu>; 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.Meskes@gmx.net | Use PostgreSQL!
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: [INTERFACES] facing problem with ecpg
1999-02-11 16:42 Re: [INTERFACES] facing problem with ecpg hoelc <hoelc@pd.jaring.my>
@ 1999-02-11 19:51 ` Michael Meskes <Michael.Meskes@gmx.net>
0 siblings, 0 replies; 7+ messages in thread
From: Michael Meskes @ 1999-02-11 19:51 UTC (permalink / raw)
To: hoelc <hoelc@pd.jaring.my>; +Cc: Michael Meskes <Michael_Meskes@topmail.de>; James Thompson <jamest@math.ksu.edu>; pgsql-interfaces
On Fri, Feb 12, 1999 at 12:42:34AM +0800, hoelc wrote:
> 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'
The exec sql should be there after running ecpg. ecpg is a preprocessor. You
have to feed you're source (should be named file.pgc BTW) through ecpg
before running cc. That is:
ecpg tryecpg.pgc
cc -o tryecpg tryecpg.c -lecpg -lpq
> What went wrong ? Please advise.
If this was not the problem we need more details.
> 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?
The reference is pretty outdated but the source comes with three examples.
Oracle's Pro*C manual however is a good reference for the syntac of embedded
SQL, although it does not comply with the standard on some parts.
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.Meskes@gmx.net | Use PostgreSQL!
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: [INTERFACES] facing problem with ecpg
@ 1999-02-12 06:06 Michael Meskes <Michael_Meskes@topmail.de>
1999-02-12 06:36 ` Re: [INTERFACES] facing problem with ecpg Thomas G. Lockhart <lockhart@alumni.caltech.edu>
0 siblings, 1 reply; 7+ messages in thread
From: Michael Meskes @ 1999-02-12 06:06 UTC (permalink / raw)
To: pgsql-interfaces
On Fri, Feb 12, 1999 at 12:42:34AM +0800, hoelc wrote:
> 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'
The exec sql should be there after running ecpg. ecpg is a preprocessor. You
have to feed you're source (should be named file.pgc BTW) through ecpg
before running cc. That is:
ecpg tryecpg.pgc
cc -o tryecpg tryecpg.c -lecpg -lpq
> What went wrong ? Please advise.
If this was not the problem we need more details.
> 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?
The reference is pretty outdated but the source comes with three examples.
Oracle's Pro*C manual however is a good reference for the syntac of embedded
SQL, although it does not comply with the standard on some parts.
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.Meskes@gmx.net | Use PostgreSQL!
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: [INTERFACES] facing problem with ecpg
1999-02-12 06:06 Re: [INTERFACES] facing problem with ecpg Michael Meskes <Michael_Meskes@topmail.de>
@ 1999-02-12 06:36 ` Thomas G. Lockhart <lockhart@alumni.caltech.edu>
1999-02-12 16:19 ` Re: [INTERFACES] facing problem with ecpg Michael Meskes <Michael_Meskes@topmail.de>
0 siblings, 1 reply; 7+ messages in thread
From: Thomas G. Lockhart @ 1999-02-12 06:36 UTC (permalink / raw)
To: Michael Meskes <Michael_Meskes@topmail.de>; +Cc: pgsql-interfaces
> The exec sql should be there after running ecpg. ecpg is a
> preprocessor. You have to feed you're source (should be named file.pgc
> BTW) through ecpg before running cc. That is:
> ecpg tryecpg.pgc
> cc -o tryecpg tryecpg.c -lecpg -lpq
Michael, could you add a short section with this info to your ecpg sgml
documentation? Also, perhaps you would want to include an example on how
to set up a makefile with a general production rule.
- Tom
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: [INTERFACES] facing problem with ecpg
1999-02-12 06:06 Re: [INTERFACES] facing problem with ecpg Michael Meskes <Michael_Meskes@topmail.de>
1999-02-12 06:36 ` Re: [INTERFACES] facing problem with ecpg Thomas G. Lockhart <lockhart@alumni.caltech.edu>
@ 1999-02-12 16:19 ` Michael Meskes <Michael_Meskes@topmail.de>
1999-02-13 02:46 ` Re: [INTERFACES] facing problem with ecpg Thomas G. Lockhart <lockhart@alumni.caltech.edu>
0 siblings, 1 reply; 7+ messages in thread
From: Michael Meskes @ 1999-02-12 16:19 UTC (permalink / raw)
To: pgsql-interfaces
On Fri, Feb 12, 1999 at 06:36:26AM +0000, Thomas G. Lockhart wrote:
> Michael, could you add a short section with this info to your ecpg sgml
> documentation? Also, perhaps you would want to include an example on how
I hope I find the time. Right now it doesn't look too good. I have some
progrfamming to do for 6.5 too.
> to set up a makefile with a general production rule.
Something like:
.pgc.c:
ecpg $?
Or do you mean a complete Makefile?
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.Meskes@gmx.net | Use PostgreSQL!
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: [INTERFACES] facing problem with ecpg
1999-02-12 06:06 Re: [INTERFACES] facing problem with ecpg Michael Meskes <Michael_Meskes@topmail.de>
1999-02-12 06:36 ` Re: [INTERFACES] facing problem with ecpg Thomas G. Lockhart <lockhart@alumni.caltech.edu>
1999-02-12 16:19 ` Re: [INTERFACES] facing problem with ecpg Michael Meskes <Michael_Meskes@topmail.de>
@ 1999-02-13 02:46 ` Thomas G. Lockhart <lockhart@alumni.caltech.edu>
1999-02-13 11:39 ` Re: [INTERFACES] facing problem with ecpg Michael Meskes <Michael_Meskes@topmail.de>
0 siblings, 1 reply; 7+ messages in thread
From: Thomas G. Lockhart @ 1999-02-13 02:46 UTC (permalink / raw)
To: Michael Meskes <Michael_Meskes@topmail.de>; +Cc: pgsql-interfaces
> Something like:
>
> .pgc.c:
> ecpg $?
>
> Or do you mean a complete Makefile?
No, your simple snippet is probably enough. Aren't there some makefiles
in the source tree which we could point to also?
- Tom
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: [INTERFACES] facing problem with ecpg
1999-02-12 06:06 Re: [INTERFACES] facing problem with ecpg Michael Meskes <Michael_Meskes@topmail.de>
1999-02-12 06:36 ` Re: [INTERFACES] facing problem with ecpg Thomas G. Lockhart <lockhart@alumni.caltech.edu>
1999-02-12 16:19 ` Re: [INTERFACES] facing problem with ecpg Michael Meskes <Michael_Meskes@topmail.de>
1999-02-13 02:46 ` Re: [INTERFACES] facing problem with ecpg Thomas G. Lockhart <lockhart@alumni.caltech.edu>
@ 1999-02-13 11:39 ` Michael Meskes <Michael_Meskes@topmail.de>
0 siblings, 0 replies; 7+ messages in thread
From: Michael Meskes @ 1999-02-13 11:39 UTC (permalink / raw)
To: pgsql-interfaces
On Sat, Feb 13, 1999 at 02:46:59AM +0000, Thomas G. Lockhart wrote:
> > Something like:
> >
> > .pgc.c:
> > ecpg $?
> >
> > Or do you mean a complete Makefile?
>
> No, your simple snippet is probably enough. Aren't there some makefiles
> in the source tree which we could point to also?
Yes: interfaces/ecpg/test/Makefile.
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.Meskes@gmx.net | Use PostgreSQL!
^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~1999-02-13 11:39 UTC | newest]
Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-02-11 16:42 Re: [INTERFACES] facing problem with ecpg hoelc <hoelc@pd.jaring.my>
1999-02-11 19:51 ` Michael Meskes <Michael.Meskes@gmx.net>
1999-02-12 06:06 Re: [INTERFACES] facing problem with ecpg Michael Meskes <Michael_Meskes@topmail.de>
1999-02-12 06:36 ` Thomas G. Lockhart <lockhart@alumni.caltech.edu>
1999-02-12 16:19 ` Michael Meskes <Michael_Meskes@topmail.de>
1999-02-13 02:46 ` Thomas G. Lockhart <lockhart@alumni.caltech.edu>
1999-02-13 11:39 ` Michael Meskes <Michael_Meskes@topmail.de>
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