11\input texinfo @c -*-texinfo-*-
22@c %**start of header
33@setfilename ecpg.info
4- @settitle Ecpg - Embedded SQL in C for Postgres95
4+ @settitle Ecpg - Embedded SQL in C for PostgreSQL
55@setchapternewpage odd
66@c %**end of header
77
88@ifinfo
9- This file documents an embedded SQL in C package forPostgres 95 .
9+ This file documents an embedded SQL in C package forPostgreSQL .
1010
1111Copyright 1996 Linus Tolke
1212
1313Permission is granted to copy and use in the same way as you are allowed
14- to copy and use the rest of thePostgres 95 .
14+ to copy and use the rest of thePostgreSQL .
1515@end ifinfo
1616
1717@c This title page illustrates only one of the
1818@c two methods of forming a title page.
1919
2020@titlepage
2121@title ECPG
22- @subtitle Embedded SQL in C for Postgres95
22+ @subtitle Embedded SQL in C for PostgreSQL
2323@author Linus Tolke
2424
2525@c The following two commands
2626@c start the copyright page.
2727@page
2828@vskip 0pt plus 1filll
29- Copyright@copyright {} 1996 Linus Tolke
29+ Copyright@copyright {} 1996-1997 Linus Tolke, 1998 Michael Meskes
3030
3131Published by Linus Tolke
3232
3333Permission is granted to copy and use in the same way as you are allowed
34- to copy and use the rest of thePostgres 95 .
34+ to copy and use the rest of thePostgreSQL .
3535@end titlepage
3636
3737@node Top ,Why embedded SQL ,(dir) ,(dir)
3838@comment node-name, next, previous, up
3939
4040@ifinfo
41- Ecpg is an embedded sql preprocessor for C and library forPostgres95.
41+ Ecpg is an embedded sql preprocessor for C and library forPostgresSQL
4242
43- It is written by Linus Tolke <linus@@ epact.se>
43+ It is written by Linus Tolke <linus@@ epact.se> and Michael Meskes <meskes @@ debian.org>.
4444
45- This texinfo page and the code is all the documentation you get. There
46- will not be any separate manual page, installation description or
47- buglist.
4845@end ifinfo
4946
5047@menu
@@ -86,7 +83,7 @@ work. Most embedded sql preprocessors I have seen and heard of makes
8683extensions so it is difficult to obtain portability even between them
8784anyway. I have not read the standard but I hope that my implementation
8885does not deviate to much and that it would be possible to port programs
89- with embedded sql written for other DBMS:s toPostgres95 and thus
86+ with embedded sql written for other DBMS:s toPostgreSQL and thus
9087promoting the spirit of free software.
9188
9289
@@ -135,36 +132,34 @@ This chapter describes how to use the ECPG tool.
135132@cindex preprocessor
136133@cindex @code {ecpg }
137134The preprocessor is called@code {ecpg }. After installation it resides in
138- the postgres@code {bin } directory. It accepts two arguments like
139- @code {iname=filename } and@code {oname=filename }. Both arguments must be
140- present or an error will occur.
135+ the postgres@code {bin } directory.
141136
142137@node Library ,Error handling ,Preprocessor ,How to use it
143138@section Library
144139
145140@cindex library functions
146141@cindex @code {libecpg.a }
147142@cindex @code {-lecpg }
148- The library is called@code {libecpg.a }. The library used the pq library
149- for the communication to the postgres server so you will have to link
150- your program with@code {-lecpg -lpq }.
143+ The library is called@code {libecpg.a } resp. @code { libecpg.so }. The library
144+ used the pq library for the communication to the postgres server so you will
145+ have to link your program with@code {-lecpg -lpq }.
151146
152147The library has some methods that are "hidden" but that could prove very
153148useful sometime.
154149
155150@table @asis
156- @item @code {ECPGdebug(int) }
157- @cindex @code {ECPGdebug(int) }
151+ @item @code {ECPGdebug(int , FILE *stream ) }
152+ @cindex @code {ECPGdebug(int , FILE *stream ) }
158153@cindex debuglogging
159- If this is called, witha non-zero argument , then debuglogging is turned
160- on. Debuglogging is done on@code {stderr }. Most SQL statement logs its
154+ If this is called, withthe first argument non-zero, then debuglogging is turned
155+ on. Debuglogging is done on@code {stream }. Most SQL statement logs its
161156arguments and result.
162157
163158The most important one (@code {ECPGdo }) that is called on all SQL
164159statements except@code {EXEC SQL COMMIT },@code {EXEC SQL ROLLBACK },
165160@code {EXEC SQL CONNECT } logs both its expanded string, i.e. the string
166161with all the input variables inserted, and the result from the
167- postgres95 server. This can be very useful when searching for errors
162+ PostgreSQL server. This can be very useful when searching for errors
168163in your SQL statements.
169164
170165@item @code {ECPGstatus() }
@@ -222,11 +217,11 @@ are running incompatible versions of the preprocessor and the library.
222217The preprocessor has goofed up and generated some incorrect code.
223218
224219@item -1, Error starting transaction line %d.
225- Postgres95 signalled to us that we cannot open the connection.
220+ PostgreSQL signalled to us that we cannot open the connection.
226221
227222@item -1, Postgres error: %s line %d.
228- Somepostgres95 error. The message contains the error message from the
229- postgres95 backend.
223+ SomePostgreSQL error. The message contains the error message from the
224+ PostgreSQL backend.
230225
231226@item 1, Data not found line %d.
232227This is a "normal" error that tells you that what you are quering cannot
@@ -238,53 +233,53 @@ you made probably was not unique.
238233
239234@item -1, Not correctly formatted int type: %s line %d.
240235This means that the host variable is of an@code {int } type and the field
241- in thepostgres95 database is of another type and contains a value that
236+ in thePostgreSQL database is of another type and contains a value that
242237cannot be interpreted as an@code {int }. The library uses@code {strtol }
243238for this conversion.
244239
245240@item -1, Not correctly formatted unsigned type: %s line %d.
246241This means that the host variable is of an@code {unsigned int } type and
247- the field in thepostgres95 database is of another type and contains a
242+ the field in thePostgreSQL database is of another type and contains a
248243value that cannot be interpreted as an@code {unsigned int }. The library
249244uses@code {strtoul } for this conversion.
250245
251246@item -1, Not correctly formatted floating point type: %s line %d.
252247This means that the host variable is of an@code {float } type and
253- the field in thepostgres95 database is of another type and contains a
248+ the field in thePostgreSQL database is of another type and contains a
254249value that cannot be interpreted as an@code {float }. The library
255250uses@code {strtod } for this conversion.
256251
257252@item -1, Too few arguments line %d.
258- This means thatthe postgres95 has returned more records than we have
253+ This means thatPostgreSQL has returned more records than we have
259254matching variables. Perhaps you have forgotten a couple of the host
260255variables in the@code {INTO :var1 ,:var2 }-list.
261256
262257@item -1, Too many arguments line %d.
263- This means thatth postgres95 has returned fewer records than we have
258+ This means thatPostgreSQL has returned fewer records than we have
264259host variables. Perhaps you have to many host variables in the
265260@code {INTO :var1 ,:var2 }-list.
266261
267262@item -1, Empty query line %d.
268- Postgres95 returned PGRES_EMPTY_QUERY.
263+ PostgreSQL returned PGRES_EMPTY_QUERY.
269264
270265@item -1, Error: %s line %d.
271- This means thatPostgres95 returned on of the errors
266+ This means thatPostgreSQL returned on of the errors
272267PGRES_NONFATAL_ERROR, PGRES_FATAL_ERROR or PGRES_BAD_RESPONSE. Which one
273268and why is explained in the message.
274269
275270@item -1, Postgres error line %d.
276- Postgres95 returns something that the library does not know how to
277- handle. This is probably because the version ofpostgres95 does not
271+ PostgreSQL returns something that the library does not know how to
272+ handle. This is probably because the version ofPostgreSQL does not
278273match the version of the ecpg library.
279274
280275@item -1, Error committing line %d.
281276Error during@code {COMMIT }.@code {EXEC SQL COMMIT } is translated to an
282- @code {end } operation inpostgres95 and that is the operation that could
277+ @code {end } operation inPostgreSQL and that is the operation that could
283278not be performed.
284279
285280@item -1, Error rolling back line %d.
286281Error during@code {ROLLBACK }.@code {EXEC SQL ROLLBACK } is translated to
287- an@code {abort } operation inpostgres95 and that is the operation that
282+ an@code {abort } operation inPostgreSQL and that is the operation that
288283could not be performed.
289284
290285@item -1, ECPGconnect: could not open database %s.
@@ -328,36 +323,9 @@ actually does port something...
328323@chapter Installation
329324@cindex installation
330325
331- Step by step installation (if everything goes ok):
332-
333- @enumerate
334- @item Fetch everything and unpack
335-
336- If you are reading this documentation you have probably managed this
337- step already.
338-
339- @item @code {./configure --with-postgres=/path/to/postgres }
340-
341- This is to be done in the ecpg directory, i.e. the directory containing
342- the@file {configure } file.
343-
344- The@file {/path/to/postgres } is the path to the installed postgres. It
345- points out the directory where the include, lib and bin directories
346- reside. The include directory is used when building the library and all
347- three of them become residents for ecpg include files, library and
348- binaries.
349-
350- @item @code {make all }
351-
352- @item As the postgres user@code {make install }
353-
354- The postgres user is the owner of the postgres include, lib and bin
355- directories. The installation procedure installs its files there
356- alongside the postgres files.
357- @item Done.
358-
359- @end enumerate
360-
326+ Since version 0.5 ecpg is distributed together with PostgreSQL. So you
327+ should get your precompiler, libraries and header files compiled and
328+ installed on the fly.
361329
362330@node Index ,For the developer ,Installation ,Top
363331@unnumbered Index
@@ -394,12 +362,8 @@ In the alpha version the preprocessor has a lot of flaws:
394362@item Preprocessor output
395363The variables should be static.
396364
397- @item The preprocessor interface is strange, to say the least
398- It would be better with a consistant unix arguments interface, perhaps
399- builtin default filenames so they won't have to be given all the time.
400-
401365@item Preprocessor cannot do syntax checking on your SQL statements
402- Whatever you write is copied more or less exactly to thepostgres95 and
366+ Whatever you write is copied more or less exactly to thePostgreSQL and
403367you will not be able to locate your errors until run-time.
404368
405369@item no restriction to strings only
@@ -464,7 +428,7 @@ than could be realised in a script.
464428@comment node-name, next, previous, up
465429@section The preprocessor
466430
467- Firstthree lines are written to the output.A comment and two include
431+ Firstfour lines are written to the output.Two comments and two include
468432lines necessary for the interface to the library.
469433
470434Then the preprocessor works in one pass only reading the input file and
@@ -533,7 +497,7 @@ An open cursor statement looks like:
533497@example
534498exec sql open blablabla;
535499@end example
536- andthat is ignore and not copied from the output.
500+ and is ignore and not copied from the output.
537501
538502@item Commit statement
539503@cindex Commit statement