Обсуждение: Re: [INTERFACES] facing problem with ecpg
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!
> 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
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!
> 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
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!