Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
72aa1dab
Commit
72aa1dab
authored
Feb 11, 1998
by
Marc G. Fournier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
From: Michael Meskes <meskes@topsystem.de>
Cleanups for ecpg, as well as a missing patch so that its configured in
parent
755c2be9
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
48 additions
and
85 deletions
+48
-85
src/configure
src/configure
+2
-2
src/configure.in
src/configure.in
+1
-1
src/interfaces/Makefile
src/interfaces/Makefile
+2
-1
src/interfaces/ecpg/Makefile
src/interfaces/ecpg/Makefile
+1
-1
src/interfaces/ecpg/TODO
src/interfaces/ecpg/TODO
+4
-6
src/interfaces/ecpg/doc/ecpg.texinfo
src/interfaces/ecpg/doc/ecpg.texinfo
+38
-74
No files found.
src/configure
View file @
72aa1dab
...
@@ -4481,7 +4481,7 @@ done
...
@@ -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 in
terfaces/ecpg/preproc/Makefile interfaces/ecpg/lib/Makefile interfaces/ecpg/include/Makefile in
clude/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
...
@@ -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
...
...
src/configure.in
View file @
72aa1dab
...
@@ -541,4 +541,4 @@ else
...
@@ -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
)
src/interfaces/Makefile
View file @
72aa1dab
...
@@ -7,7 +7,7 @@
...
@@ -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
...
@@ -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
...
...
src/interfaces/ecpg/Makefile
View file @
72aa1dab
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
src/interfaces/ecpg/TODO
View file @
72aa1dab
...
@@ -2,10 +2,6 @@ This list is still from Linus. MM
...
@@ -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.
...
@@ -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.
src/interfaces/ecpg/doc/ecpg.texinfo
View file @
72aa1dab
\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 Postgre
s95
@settitle Ecpg - Embedded SQL in C for Postgre
SQL
@setchapternewpage odd
@setchapternewpage odd
@c
%**end of header
@c
%**end of header
@ifinfo
@ifinfo
This file documents an embedded SQL in C package for Postgre
s 95
.
This file documents an embedded SQL in C package for Postgre
SQL
.
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 Postgre
s 95
.
to copy and use the rest of the Postgre
SQL
.
@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.
...
@@ -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 Postgre
s95
@subtitle Embedded SQL in C for Postgre
SQL
@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 Postgre
s 95
.
to copy and use the rest of the Postgre
SQL
.
@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 Postgres
95.
Ecpg is an embedded sql preprocessor for C and library for Postgres
SQL
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
...
@@ -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 Postgre
s95
and thus
with embedded sql written for other DBMS:s to Postgre
SQL
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.
...
@@ -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.
...
@@ -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
{
st
derr
}
. Most SQL statement logs its
on. Debuglogging is done on @code
{
st
ream
}
. 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.
...
@@ -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.
Postgre
s95
signalled to us that we cannot open the connection.
Postgre
SQL
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.
...
@@ -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.
Postgre
s95
returned PGRES
_
EMPTY
_
QUERY.
Postgre
SQL
returned PGRES
_
EMPTY
_
QUERY.
@item -1, Error:
%s line %d.
@item -1, Error:
%s line %d.
This means that Postgre
s95
returned on of the errors
This means that Postgre
SQL
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.
Postgre
s95
returns something that the library does not know how to
Postgre
SQL
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...
...
@@ -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:
...
@@ -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.
...
@@ -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:
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment