From: Michael Meskes <meskes@topsystem.de>
Cleanups for ecpg, as well as a missing patch so that its configured in
This commit is contained in:
parent
755c2be9b4
commit
72aa1dabb9
4
src/configure
vendored
4
src/configure
vendored
@ -4481,7 +4481,7 @@ done
|
|||||||
|
|
||||||
ac_given_srcdir=$srcdir
|
ac_given_srcdir=$srcdir
|
||||||
|
|
||||||
trap 'rm -fr `echo "GNUmakefile Makefile.global backend/port/Makefile bin/pg_version/Makefile bin/psql/Makefile bin/pg_dump/Makefile backend/utils/Gen_fmgrtab.sh interfaces/libpq/Makefile interfaces/libpgtcl/Makefile include/config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
|
trap 'rm -fr `echo "GNUmakefile Makefile.global backend/port/Makefile bin/pg_version/Makefile bin/psql/Makefile bin/pg_dump/Makefile backend/utils/Gen_fmgrtab.sh interfaces/libpq/Makefile interfaces/libpgtcl/Makefile interfaces/ecpg/preproc/Makefile interfaces/ecpg/lib/Makefile interfaces/ecpg/include/Makefile include/config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
|
||||||
EOF
|
EOF
|
||||||
cat >> $CONFIG_STATUS <<EOF
|
cat >> $CONFIG_STATUS <<EOF
|
||||||
|
|
||||||
@ -4603,7 +4603,7 @@ EOF
|
|||||||
|
|
||||||
cat >> $CONFIG_STATUS <<EOF
|
cat >> $CONFIG_STATUS <<EOF
|
||||||
|
|
||||||
CONFIG_FILES=\${CONFIG_FILES-"GNUmakefile Makefile.global backend/port/Makefile bin/pg_version/Makefile bin/psql/Makefile bin/pg_dump/Makefile backend/utils/Gen_fmgrtab.sh interfaces/libpq/Makefile interfaces/libpgtcl/Makefile"}
|
CONFIG_FILES=\${CONFIG_FILES-"GNUmakefile Makefile.global backend/port/Makefile bin/pg_version/Makefile bin/psql/Makefile bin/pg_dump/Makefile backend/utils/Gen_fmgrtab.sh interfaces/libpq/Makefile interfaces/libpgtcl/Makefile interfaces/ecpg/preproc/Makefile interfaces/ecpg/lib/Makefile interfaces/ecpg/include/Makefile "}
|
||||||
EOF
|
EOF
|
||||||
cat >> $CONFIG_STATUS <<\EOF
|
cat >> $CONFIG_STATUS <<\EOF
|
||||||
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
|
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
|
||||||
|
@ -541,4 +541,4 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
AC_OUTPUT(GNUmakefile Makefile.global backend/port/Makefile bin/pg_version/Makefile bin/psql/Makefile bin/pg_dump/Makefile backend/utils/Gen_fmgrtab.sh interfaces/libpq/Makefile interfaces/libpgtcl/Makefile)
|
AC_OUTPUT(GNUmakefile Makefile.global backend/port/Makefile bin/pg_version/Makefile bin/psql/Makefile bin/pg_dump/Makefile backend/utils/Gen_fmgrtab.sh interfaces/libpq/Makefile interfaces/libpgtcl/Makefile interfaces/ecpg/preproc/Makefile interfaces/ecpg/lib/Makefile interfaces/ecpg/include/Makefile )
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
# IDENTIFICATION
|
# IDENTIFICATION
|
||||||
# $Header: /cvsroot/pgsql/src/interfaces/Makefile,v 1.4 1998/01/25 04:14:36 scrappy Exp $
|
# $Header: /cvsroot/pgsql/src/interfaces/Makefile,v 1.5 1998/02/11 15:17:47 scrappy Exp $
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -16,6 +16,7 @@ include $(SRCDIR)/Makefile.global
|
|||||||
|
|
||||||
.DEFAULT all:
|
.DEFAULT all:
|
||||||
$(MAKE) -C libpq $@
|
$(MAKE) -C libpq $@
|
||||||
|
$(MAKE) -C ecpg $@
|
||||||
ifeq ($(HAVE_Cplusplus), true)
|
ifeq ($(HAVE_Cplusplus), true)
|
||||||
$(MAKE) -C libpq++ $@
|
$(MAKE) -C libpq++ $@
|
||||||
else
|
else
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
SUBDIRS = include lib preproc
|
SUBDIRS = include lib preproc doc
|
||||||
|
|
||||||
all install uninstall clean:
|
all install uninstall clean:
|
||||||
for i in $(SUBDIRS); do ( cd $$i; make $@ ); done
|
for i in $(SUBDIRS); do ( cd $$i; make $@ ); done
|
||||||
|
@ -2,10 +2,6 @@ This list is still from Linus. MM
|
|||||||
|
|
||||||
The variables should be static.
|
The variables should be static.
|
||||||
|
|
||||||
The preprocessor interface is strange, to say the least It would be better
|
|
||||||
with a consistant unix arguments interface, perhaps builtin default
|
|
||||||
filenames so they won't have to be given all the time. (Done: MM 2/5/98)
|
|
||||||
|
|
||||||
Preprocessor cannot do syntax checking on your SQL statements Whatever you
|
Preprocessor cannot do syntax checking on your SQL statements Whatever you
|
||||||
write is copied more or less exactly to the postgres95 and you will not be
|
write is copied more or less exactly to the postgres95 and you will not be
|
||||||
able to locate your errors until run-time.
|
able to locate your errors until run-time.
|
||||||
@ -48,6 +44,8 @@ could be realised in a script.
|
|||||||
|
|
||||||
Now comes my list (MM):
|
Now comes my list (MM):
|
||||||
|
|
||||||
libecpg should be made a shared library.
|
Ecpg should remove variables from its list as soon as they are undefined and
|
||||||
|
not rely on cc to report an error.
|
||||||
|
|
||||||
|
Variable definitions containing static/volatile have to be possible.
|
||||||
|
|
||||||
Makefiles have to able to correctly install and clean.
|
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
\input texinfo @c -*-texinfo-*-
|
\input texinfo @c -*-texinfo-*-
|
||||||
@c %**start of header
|
@c %**start of header
|
||||||
@setfilename ecpg.info
|
@setfilename ecpg.info
|
||||||
@settitle Ecpg - Embedded SQL in C for Postgres95
|
@settitle Ecpg - Embedded SQL in C for PostgreSQL
|
||||||
@setchapternewpage odd
|
@setchapternewpage odd
|
||||||
@c %**end of header
|
@c %**end of header
|
||||||
|
|
||||||
@ifinfo
|
@ifinfo
|
||||||
This file documents an embedded SQL in C package for Postgres 95.
|
This file documents an embedded SQL in C package for PostgreSQL.
|
||||||
|
|
||||||
Copyright 1996 Linus Tolke
|
Copyright 1996 Linus Tolke
|
||||||
|
|
||||||
Permission is granted to copy and use in the same way as you are allowed
|
Permission is granted to copy and use in the same way as you are allowed
|
||||||
to copy and use the rest of the Postgres 95.
|
to copy and use the rest of the PostgreSQL.
|
||||||
@end ifinfo
|
@end ifinfo
|
||||||
|
|
||||||
@c This title page illustrates only one of the
|
@c This title page illustrates only one of the
|
||||||
@ -19,32 +19,29 @@ to copy and use the rest of the Postgres 95.
|
|||||||
|
|
||||||
@titlepage
|
@titlepage
|
||||||
@title ECPG
|
@title ECPG
|
||||||
@subtitle Embedded SQL in C for Postgres95
|
@subtitle Embedded SQL in C for PostgreSQL
|
||||||
@author Linus Tolke
|
@author Linus Tolke
|
||||||
|
|
||||||
@c The following two commands
|
@c The following two commands
|
||||||
@c start the copyright page.
|
@c start the copyright page.
|
||||||
@page
|
@page
|
||||||
@vskip 0pt plus 1filll
|
@vskip 0pt plus 1filll
|
||||||
Copyright @copyright{} 1996 Linus Tolke
|
Copyright @copyright{} 1996-1997 Linus Tolke, 1998 Michael Meskes
|
||||||
|
|
||||||
Published by Linus Tolke
|
Published by Linus Tolke
|
||||||
|
|
||||||
Permission is granted to copy and use in the same way as you are allowed
|
Permission is granted to copy and use in the same way as you are allowed
|
||||||
to copy and use the rest of the Postgres 95.
|
to copy and use the rest of the PostgreSQL.
|
||||||
@end titlepage
|
@end titlepage
|
||||||
|
|
||||||
@node Top, Why embedded SQL, (dir), (dir)
|
@node Top, Why embedded SQL, (dir), (dir)
|
||||||
@comment node-name, next, previous, up
|
@comment node-name, next, previous, up
|
||||||
|
|
||||||
@ifinfo
|
@ifinfo
|
||||||
Ecpg is an embedded sql preprocessor for C and library for Postgres95.
|
Ecpg is an embedded sql preprocessor for C and library for PostgresSQL
|
||||||
|
|
||||||
It is written by Linus Tolke <linus@@epact.se>
|
It is written by Linus Tolke <linus@@epact.se> and Michael Meskes <meskes@@debian.org>.
|
||||||
|
|
||||||
This texinfo page and the code is all the documentation you get. There
|
|
||||||
will not be any separate manual page, installation description or
|
|
||||||
buglist.
|
|
||||||
@end ifinfo
|
@end ifinfo
|
||||||
|
|
||||||
@menu
|
@menu
|
||||||
@ -86,7 +83,7 @@ work. Most embedded sql preprocessors I have seen and heard of makes
|
|||||||
extensions so it is difficult to obtain portability even between them
|
extensions so it is difficult to obtain portability even between them
|
||||||
anyway. I have not read the standard but I hope that my implementation
|
anyway. I have not read the standard but I hope that my implementation
|
||||||
does not deviate to much and that it would be possible to port programs
|
does not deviate to much and that it would be possible to port programs
|
||||||
with embedded sql written for other DBMS:s to Postgres95 and thus
|
with embedded sql written for other DBMS:s to PostgreSQL and thus
|
||||||
promoting the spirit of free software.
|
promoting the spirit of free software.
|
||||||
|
|
||||||
|
|
||||||
@ -135,9 +132,7 @@ This chapter describes how to use the ECPG tool.
|
|||||||
@cindex preprocessor
|
@cindex preprocessor
|
||||||
@cindex @code{ecpg}
|
@cindex @code{ecpg}
|
||||||
The preprocessor is called @code{ecpg}. After installation it resides in
|
The preprocessor is called @code{ecpg}. After installation it resides in
|
||||||
the postgres @code{bin} directory. It accepts two arguments like
|
the postgres @code{bin} directory.
|
||||||
@code{iname=filename} and @code{oname=filename}. Both arguments must be
|
|
||||||
present or an error will occur.
|
|
||||||
|
|
||||||
@node Library, Error handling, Preprocessor, How to use it
|
@node Library, Error handling, Preprocessor, How to use it
|
||||||
@section Library
|
@section Library
|
||||||
@ -145,26 +140,26 @@ present or an error will occur.
|
|||||||
@cindex library functions
|
@cindex library functions
|
||||||
@cindex @code{libecpg.a}
|
@cindex @code{libecpg.a}
|
||||||
@cindex @code{-lecpg}
|
@cindex @code{-lecpg}
|
||||||
The library is called @code{libecpg.a}. The library used the pq library
|
The library is called @code{libecpg.a} resp. @code{libecpg.so}. The library
|
||||||
for the communication to the postgres server so you will have to link
|
used the pq library for the communication to the postgres server so you will
|
||||||
your program with @code{-lecpg -lpq}.
|
have to link your program with @code{-lecpg -lpq}.
|
||||||
|
|
||||||
The library has some methods that are "hidden" but that could prove very
|
The library has some methods that are "hidden" but that could prove very
|
||||||
useful sometime.
|
useful sometime.
|
||||||
|
|
||||||
@table @asis
|
@table @asis
|
||||||
@item @code{ECPGdebug(int)}
|
@item @code{ECPGdebug(int, FILE *stream)}
|
||||||
@cindex @code{ECPGdebug(int)}
|
@cindex @code{ECPGdebug(int, FILE *stream)}
|
||||||
@cindex debuglogging
|
@cindex debuglogging
|
||||||
If this is called, with a non-zero argument, then debuglogging is turned
|
If this is called, with the first argument non-zero, then debuglogging is turned
|
||||||
on. Debuglogging is done on @code{stderr}. Most SQL statement logs its
|
on. Debuglogging is done on @code{stream}. Most SQL statement logs its
|
||||||
arguments and result.
|
arguments and result.
|
||||||
|
|
||||||
The most important one (@code{ECPGdo}) that is called on all SQL
|
The most important one (@code{ECPGdo}) that is called on all SQL
|
||||||
statements except @code{EXEC SQL COMMIT}, @code{EXEC SQL ROLLBACK},
|
statements except @code{EXEC SQL COMMIT}, @code{EXEC SQL ROLLBACK},
|
||||||
@code{EXEC SQL CONNECT} logs both its expanded string, i.e. the string
|
@code{EXEC SQL CONNECT} logs both its expanded string, i.e. the string
|
||||||
with all the input variables inserted, and the result from the
|
with all the input variables inserted, and the result from the
|
||||||
postgres95 server. This can be very useful when searching for errors
|
PostgreSQL server. This can be very useful when searching for errors
|
||||||
in your SQL statements.
|
in your SQL statements.
|
||||||
|
|
||||||
@item @code{ECPGstatus()}
|
@item @code{ECPGstatus()}
|
||||||
@ -222,11 +217,11 @@ are running incompatible versions of the preprocessor and the library.
|
|||||||
The preprocessor has goofed up and generated some incorrect code.
|
The preprocessor has goofed up and generated some incorrect code.
|
||||||
|
|
||||||
@item -1, Error starting transaction line %d.
|
@item -1, Error starting transaction line %d.
|
||||||
Postgres95 signalled to us that we cannot open the connection.
|
PostgreSQL signalled to us that we cannot open the connection.
|
||||||
|
|
||||||
@item -1, Postgres error: %s line %d.
|
@item -1, Postgres error: %s line %d.
|
||||||
Some postgres95 error. The message contains the error message from the
|
Some PostgreSQL error. The message contains the error message from the
|
||||||
postgres95 backend.
|
PostgreSQL backend.
|
||||||
|
|
||||||
@item 1, Data not found line %d.
|
@item 1, Data not found line %d.
|
||||||
This is a "normal" error that tells you that what you are quering cannot
|
This is a "normal" error that tells you that what you are quering cannot
|
||||||
@ -238,53 +233,53 @@ you made probably was not unique.
|
|||||||
|
|
||||||
@item -1, Not correctly formatted int type: %s line %d.
|
@item -1, Not correctly formatted int type: %s line %d.
|
||||||
This means that the host variable is of an @code{int} type and the field
|
This means that the host variable is of an @code{int} type and the field
|
||||||
in the postgres95 database is of another type and contains a value that
|
in the PostgreSQL database is of another type and contains a value that
|
||||||
cannot be interpreted as an @code{int}. The library uses @code{strtol}
|
cannot be interpreted as an @code{int}. The library uses @code{strtol}
|
||||||
for this conversion.
|
for this conversion.
|
||||||
|
|
||||||
@item -1, Not correctly formatted unsigned type: %s line %d.
|
@item -1, Not correctly formatted unsigned type: %s line %d.
|
||||||
This means that the host variable is of an @code{unsigned int} type and
|
This means that the host variable is of an @code{unsigned int} type and
|
||||||
the field in the postgres95 database is of another type and contains a
|
the field in the PostgreSQL database is of another type and contains a
|
||||||
value that cannot be interpreted as an @code{unsigned int}. The library
|
value that cannot be interpreted as an @code{unsigned int}. The library
|
||||||
uses @code{strtoul} for this conversion.
|
uses @code{strtoul} for this conversion.
|
||||||
|
|
||||||
@item -1, Not correctly formatted floating point type: %s line %d.
|
@item -1, Not correctly formatted floating point type: %s line %d.
|
||||||
This means that the host variable is of an @code{float} type and
|
This means that the host variable is of an @code{float} type and
|
||||||
the field in the postgres95 database is of another type and contains a
|
the field in the PostgreSQL database is of another type and contains a
|
||||||
value that cannot be interpreted as an @code{float}. The library
|
value that cannot be interpreted as an @code{float}. The library
|
||||||
uses @code{strtod} for this conversion.
|
uses @code{strtod} for this conversion.
|
||||||
|
|
||||||
@item -1, Too few arguments line %d.
|
@item -1, Too few arguments line %d.
|
||||||
This means that the postgres95 has returned more records than we have
|
This means that PostgreSQL has returned more records than we have
|
||||||
matching variables. Perhaps you have forgotten a couple of the host
|
matching variables. Perhaps you have forgotten a couple of the host
|
||||||
variables in the @code{INTO :var1,:var2}-list.
|
variables in the @code{INTO :var1,:var2}-list.
|
||||||
|
|
||||||
@item -1, Too many arguments line %d.
|
@item -1, Too many arguments line %d.
|
||||||
This means that th postgres95 has returned fewer records than we have
|
This means that PostgreSQL has returned fewer records than we have
|
||||||
host variables. Perhaps you have to many host variables in the
|
host variables. Perhaps you have to many host variables in the
|
||||||
@code{INTO :var1,:var2}-list.
|
@code{INTO :var1,:var2}-list.
|
||||||
|
|
||||||
@item -1, Empty query line %d.
|
@item -1, Empty query line %d.
|
||||||
Postgres95 returned PGRES_EMPTY_QUERY.
|
PostgreSQL returned PGRES_EMPTY_QUERY.
|
||||||
|
|
||||||
@item -1, Error: %s line %d.
|
@item -1, Error: %s line %d.
|
||||||
This means that Postgres95 returned on of the errors
|
This means that PostgreSQL returned on of the errors
|
||||||
PGRES_NONFATAL_ERROR, PGRES_FATAL_ERROR or PGRES_BAD_RESPONSE. Which one
|
PGRES_NONFATAL_ERROR, PGRES_FATAL_ERROR or PGRES_BAD_RESPONSE. Which one
|
||||||
and why is explained in the message.
|
and why is explained in the message.
|
||||||
|
|
||||||
@item -1, Postgres error line %d.
|
@item -1, Postgres error line %d.
|
||||||
Postgres95 returns something that the library does not know how to
|
PostgreSQL returns something that the library does not know how to
|
||||||
handle. This is probably because the version of postgres95 does not
|
handle. This is probably because the version of PostgreSQL does not
|
||||||
match the version of the ecpg library.
|
match the version of the ecpg library.
|
||||||
|
|
||||||
@item -1, Error committing line %d.
|
@item -1, Error committing line %d.
|
||||||
Error during @code{COMMIT}. @code{EXEC SQL COMMIT} is translated to an
|
Error during @code{COMMIT}. @code{EXEC SQL COMMIT} is translated to an
|
||||||
@code{end} operation in postgres95 and that is the operation that could
|
@code{end} operation in PostgreSQL and that is the operation that could
|
||||||
not be performed.
|
not be performed.
|
||||||
|
|
||||||
@item -1, Error rolling back line %d.
|
@item -1, Error rolling back line %d.
|
||||||
Error during @code{ROLLBACK}. @code{EXEC SQL ROLLBACK} is translated to
|
Error during @code{ROLLBACK}. @code{EXEC SQL ROLLBACK} is translated to
|
||||||
an @code{abort} operation in postgres95 and that is the operation that
|
an @code{abort} operation in PostgreSQL and that is the operation that
|
||||||
could not be performed.
|
could not be performed.
|
||||||
|
|
||||||
@item -1, ECPGconnect: could not open database %s.
|
@item -1, ECPGconnect: could not open database %s.
|
||||||
@ -328,36 +323,9 @@ actually does port something...
|
|||||||
@chapter Installation
|
@chapter Installation
|
||||||
@cindex installation
|
@cindex installation
|
||||||
|
|
||||||
Step by step installation (if everything goes ok):
|
Since version 0.5 ecpg is distributed together with PostgreSQL. So you
|
||||||
|
should get your precompiler, libraries and header files compiled and
|
||||||
@enumerate
|
installed on the fly.
|
||||||
@item Fetch everything and unpack
|
|
||||||
|
|
||||||
If you are reading this documentation you have probably managed this
|
|
||||||
step already.
|
|
||||||
|
|
||||||
@item @code{./configure --with-postgres=/path/to/postgres}
|
|
||||||
|
|
||||||
This is to be done in the ecpg directory, i.e. the directory containing
|
|
||||||
the @file{configure} file.
|
|
||||||
|
|
||||||
The @file{/path/to/postgres} is the path to the installed postgres. It
|
|
||||||
points out the directory where the include, lib and bin directories
|
|
||||||
reside. The include directory is used when building the library and all
|
|
||||||
three of them become residents for ecpg include files, library and
|
|
||||||
binaries.
|
|
||||||
|
|
||||||
@item @code{make all}
|
|
||||||
|
|
||||||
@item As the postgres user @code{make install}
|
|
||||||
|
|
||||||
The postgres user is the owner of the postgres include, lib and bin
|
|
||||||
directories. The installation procedure installs its files there
|
|
||||||
alongside the postgres files.
|
|
||||||
@item Done.
|
|
||||||
|
|
||||||
@end enumerate
|
|
||||||
|
|
||||||
|
|
||||||
@node Index, For the developer, Installation, Top
|
@node Index, For the developer, Installation, Top
|
||||||
@unnumbered Index
|
@unnumbered Index
|
||||||
@ -394,12 +362,8 @@ In the alpha version the preprocessor has a lot of flaws:
|
|||||||
@item Preprocessor output
|
@item Preprocessor output
|
||||||
The variables should be static.
|
The variables should be static.
|
||||||
|
|
||||||
@item The preprocessor interface is strange, to say the least
|
|
||||||
It would be better with a consistant unix arguments interface, perhaps
|
|
||||||
builtin default filenames so they won't have to be given all the time.
|
|
||||||
|
|
||||||
@item Preprocessor cannot do syntax checking on your SQL statements
|
@item Preprocessor cannot do syntax checking on your SQL statements
|
||||||
Whatever you write is copied more or less exactly to the postgres95 and
|
Whatever you write is copied more or less exactly to the PostgreSQL and
|
||||||
you will not be able to locate your errors until run-time.
|
you will not be able to locate your errors until run-time.
|
||||||
|
|
||||||
@item no restriction to strings only
|
@item no restriction to strings only
|
||||||
@ -464,7 +428,7 @@ than could be realised in a script.
|
|||||||
@comment node-name, next, previous, up
|
@comment node-name, next, previous, up
|
||||||
@section The preprocessor
|
@section The preprocessor
|
||||||
|
|
||||||
First three lines are written to the output. A comment and two include
|
First four lines are written to the output. Two comments and two include
|
||||||
lines necessary for the interface to the library.
|
lines necessary for the interface to the library.
|
||||||
|
|
||||||
Then the preprocessor works in one pass only reading the input file and
|
Then the preprocessor works in one pass only reading the input file and
|
||||||
@ -533,7 +497,7 @@ An open cursor statement looks like:
|
|||||||
@example
|
@example
|
||||||
exec sql open blablabla;
|
exec sql open blablabla;
|
||||||
@end example
|
@end example
|
||||||
and that is ignore and not copied from the output.
|
and is ignore and not copied from the output.
|
||||||
|
|
||||||
@item Commit statement
|
@item Commit statement
|
||||||
@cindex Commit statement
|
@cindex Commit statement
|
||||||
|
Loading…
x
Reference in New Issue
Block a user