Okay, libpq++ is moved to GBorg, and all traces of it have been removed

from the core repository ... I haven't *moved* the libpq++ files out of the
tree, mainly as we want to keep them in place for past branches ...

Peter, I think I've covered all the files I need, and re-ran autoconf to make
sure the configure file is in place properly ...
This commit is contained in:
Marc G. Fournier 2002-08-22 00:15:14 +00:00
parent b663f3443b
commit da4683fbe1
35 changed files with 6 additions and 2932 deletions

View File

@ -1,7 +1,7 @@
#
# PostgreSQL top level makefile
#
# $Header: /cvsroot/pgsql/GNUmakefile.in,v 1.24 2002/03/29 17:32:48 petere Exp $
# $Header: /cvsroot/pgsql/GNUmakefile.in,v 1.25 2002/08/22 00:15:04 scrappy Exp $
#
subdir =
@ -72,7 +72,7 @@ $(distdir).tar: distdir
opt_files := src/backend/utils/mb contrib/retep/build.xml \
src/tools src/corba src/data src/tutorial \
$(addprefix src/bin/, pgaccess pgtclsh pg_encoding) \
$(addprefix src/interfaces/, odbc libpq++ libpgtcl perl5 python jdbc) \
$(addprefix src/interfaces/, odbc libpgtcl perl5 python jdbc) \
$(addprefix src/pl/, plperl tcl)
docs_files := doc/postgres.tar.gz doc/src doc/TODO.detail

863
configure vendored
View File

@ -757,18 +757,6 @@ ac_env_CPP_set=${CPP+set}
ac_env_CPP_value=$CPP
ac_cv_env_CPP_set=${CPP+set}
ac_cv_env_CPP_value=$CPP
ac_env_CXX_set=${CXX+set}
ac_env_CXX_value=$CXX
ac_cv_env_CXX_set=${CXX+set}
ac_cv_env_CXX_value=$CXX
ac_env_CXXFLAGS_set=${CXXFLAGS+set}
ac_env_CXXFLAGS_value=$CXXFLAGS
ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set}
ac_cv_env_CXXFLAGS_value=$CXXFLAGS
ac_env_CXXCPP_set=${CXXCPP+set}
ac_env_CXXCPP_value=$CXXCPP
ac_cv_env_CXXCPP_set=${CXXCPP+set}
ac_cv_env_CXXCPP_value=$CXXCPP
ac_env_DOCBOOKSTYLE_set=${DOCBOOKSTYLE+set}
ac_env_DOCBOOKSTYLE_value=$DOCBOOKSTYLE
ac_cv_env_DOCBOOKSTYLE_set=${DOCBOOKSTYLE+set}
@ -886,7 +874,6 @@ Optional Packages:
--with-unixodbc build ODBC driver for unixODBC
--with-iodbc build ODBC driver for iODBC
--with-odbcinst=DIR default directory for odbcinst.ini sysconfdir
--with-CXX build C++ modules (libpq++)
--with-gnu-ld assume the C compiler uses GNU ld default=no
Some influential environment variables:
@ -897,9 +884,6 @@ Some influential environment variables:
CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
headers in a nonstandard directory <include dir>
CPP C preprocessor
CXX C++ compiler command
CXXFLAGS C++ compiler flags
CXXCPP C++ preprocessor
DOCBOOKSTYLE
location of DocBook stylesheets
@ -1917,10 +1901,6 @@ echo "$as_me: error: argument required for --with-CC option" >&2;}
fi;
# Set here so it can be over-ridden in the template file
GCC_CXXFLAGS="-O2"
VENDOR_CXXFLAGS=""
case $template in
aix) pgac_cc_list="gcc xlc";;
irix) pgac_cc_list="cc";; # no gcc
@ -3684,586 +3664,6 @@ rm -f conftest*
#
# Optionally build C++ code (i.e., libpq++)
#
echo "$as_me:$LINENO: checking whether to build C++ modules" >&5
echo $ECHO_N "checking whether to build C++ modules... $ECHO_C" >&6
# Check whether --with-CXX or --without-CXX was given.
if test "${with_CXX+set}" = set; then
withval="$with_CXX"
case $withval in
yes)
:
;;
no)
:
;;
*)
with_CXX=yes
CXX=$withval
;;
esac
else
with_CXX=no
fi;
if test "$with_CXX" = yes; then
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
# If the user has specified CXXFLAGS in the environment, leave it
# alone, else use a default.
ac_ext=cc
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
if test -n "$ac_tool_prefix"; then
for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC
do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_CXX+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$CXX"; then
ac_cv_prog_CXX="$CXX" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
fi
fi
CXX=$ac_cv_prog_CXX
if test -n "$CXX"; then
echo "$as_me:$LINENO: result: $CXX" >&5
echo "${ECHO_T}$CXX" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
test -n "$CXX" && break
done
fi
if test -z "$CXX"; then
ac_ct_CXX=$CXX
for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$ac_ct_CXX"; then
ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CXX="$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
fi
fi
ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
if test -n "$ac_ct_CXX"; then
echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5
echo "${ECHO_T}$ac_ct_CXX" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
test -n "$ac_ct_CXX" && break
done
test -n "$ac_ct_CXX" || ac_ct_CXX="g++"
CXX=$ac_ct_CXX
fi
# Provide some information about the compiler.
echo "$as_me:$LINENO:" \
"checking for C++ compiler version" >&5
ac_compiler=`set X $ac_compile; echo $2`
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
(eval $ac_compiler --version </dev/null >&5) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
(eval $ac_compiler -v </dev/null >&5) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
(eval $ac_compiler -V </dev/null >&5) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5
echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6
if test "${ac_cv_cxx_compiler_gnu+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"
#ifdef F77_DUMMY_MAIN
# ifdef __cplusplus
extern "C"
# endif
int F77_DUMMY_MAIN() { return 1; }
#endif
int
main ()
{
#ifndef __GNUC__
choke me
#endif
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_compiler_gnu=yes
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
ac_compiler_gnu=no
fi
rm -f conftest.$ac_objext conftest.$ac_ext
ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
fi
echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5
echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6
GXX=`test $ac_compiler_gnu = yes && echo yes`
ac_test_CXXFLAGS=${CXXFLAGS+set}
ac_save_CXXFLAGS=$CXXFLAGS
CXXFLAGS="-g"
echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5
echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6
if test "${ac_cv_prog_cxx_g+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"
#ifdef F77_DUMMY_MAIN
# ifdef __cplusplus
extern "C"
# endif
int F77_DUMMY_MAIN() { return 1; }
#endif
int
main ()
{
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_prog_cxx_g=yes
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
ac_cv_prog_cxx_g=no
fi
rm -f conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5
echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6
if test "$ac_test_CXXFLAGS" = set; then
CXXFLAGS=$ac_save_CXXFLAGS
elif test $ac_cv_prog_cxx_g = yes; then
if test "$GXX" = yes; then
CXXFLAGS="-g -O2"
else
CXXFLAGS="-g"
fi
else
if test "$GXX" = yes; then
CXXFLAGS="-O2"
else
CXXFLAGS=
fi
fi
for ac_declaration in \
''\
'#include <stdlib.h>' \
'extern "C" void std::exit (int) throw (); using std::exit;' \
'extern "C" void std::exit (int); using std::exit;' \
'extern "C" void exit (int) throw ();' \
'extern "C" void exit (int);' \
'void exit (int);'
do
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"
#include <stdlib.h>
$ac_declaration
#ifdef F77_DUMMY_MAIN
# ifdef __cplusplus
extern "C"
# endif
int F77_DUMMY_MAIN() { return 1; }
#endif
int
main ()
{
exit (42);
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
:
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
continue
fi
rm -f conftest.$ac_objext conftest.$ac_ext
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"
$ac_declaration
#ifdef F77_DUMMY_MAIN
# ifdef __cplusplus
extern "C"
# endif
int F77_DUMMY_MAIN() { return 1; }
#endif
int
main ()
{
exit (42);
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
break
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
fi
rm -f conftest.$ac_objext conftest.$ac_ext
done
rm -f conftest*
if test -n "$ac_declaration"; then
echo '#ifdef __cplusplus' >>confdefs.h
echo $ac_declaration >>confdefs.h
echo '#endif' >>confdefs.h
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test "$ac_env_CXXFLAGS" != set; then
if test "$GXX" = yes; then
CXXFLAGS="$GCC_CXXFLAGS"
else
CXXFLAGS="$VENDOR_CXXFLAGS"
fi
fi
if test "$enable_debug" = yes && test "$ac_cv_prog_cxx_g" = yes; then
CXXFLAGS="$CXXFLAGS -g"
fi
{ echo "$as_me:$LINENO: using CXXFLAGS=$CXXFLAGS" >&5
echo "$as_me: using CXXFLAGS=$CXXFLAGS" >&6;}
ac_ext=cc
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5
echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6
if test -z "$CXXCPP"; then
if test "${ac_cv_prog_CXXCPP+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
# Double quotes because CXXCPP needs to be expanded
for CXXCPP in "$CXX -E" "/lib/cpp"
do
ac_preproc_ok=false
for ac_cxx_preproc_warn_flag in '' yes
do
# Use a header file that comes with gcc, so configuring glibc
# with a fresh cross-compiler works.
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"
#include <assert.h>
Syntax error
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
egrep -v '^ *\+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_cxx_preproc_warn_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
:
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
# Broken: fails on valid input.
continue
fi
rm -f conftest.err conftest.$ac_ext
# OK, works on sane cases. Now check whether non-existent headers
# can be detected and how.
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"
#include <ac_nonexistent.h>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
egrep -v '^ *\+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_cxx_preproc_warn_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
# Broken: success on invalid input.
continue
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
# Passes both tests.
ac_preproc_ok=:
break
fi
rm -f conftest.err conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
rm -f conftest.err conftest.$ac_ext
if $ac_preproc_ok; then
break
fi
done
ac_cv_prog_CXXCPP=$CXXCPP
fi
CXXCPP=$ac_cv_prog_CXXCPP
else
ac_cv_prog_CXXCPP=$CXXCPP
fi
echo "$as_me:$LINENO: result: $CXXCPP" >&5
echo "${ECHO_T}$CXXCPP" >&6
ac_preproc_ok=false
for ac_cxx_preproc_warn_flag in '' yes
do
# Use a header file that comes with gcc, so configuring glibc
# with a fresh cross-compiler works.
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"
#include <assert.h>
Syntax error
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
egrep -v '^ *\+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_cxx_preproc_warn_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
:
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
# Broken: fails on valid input.
continue
fi
rm -f conftest.err conftest.$ac_ext
# OK, works on sane cases. Now check whether non-existent headers
# can be detected and how.
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"
#include <ac_nonexistent.h>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
egrep -v '^ *\+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_cxx_preproc_warn_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
# Broken: success on invalid input.
continue
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
# Passes both tests.
ac_preproc_ok=:
break
fi
rm -f conftest.err conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
rm -f conftest.err conftest.$ac_ext
if $ac_preproc_ok; then
:
else
{ { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check" >&5
echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check" >&2;}
{ (exit 1); exit 1; }; }
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
CPPFLAGS="$CPPFLAGS $INCLUDES"
LDFLAGS="$LDFLAGS $LIBDIRS"
@ -15999,263 +15399,6 @@ _ACEOF
fi
if test "$with_CXX" = yes; then
ac_ext=cc
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
if test "${ac_cv_header_string+set}" = set; then
echo "$as_me:$LINENO: checking for string" >&5
echo $ECHO_N "checking for string... $ECHO_C" >&6
if test "${ac_cv_header_string+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
fi
echo "$as_me:$LINENO: result: $ac_cv_header_string" >&5
echo "${ECHO_T}$ac_cv_header_string" >&6
else
# Is the header compilable?
echo "$as_me:$LINENO: checking string usability" >&5
echo $ECHO_N "checking string usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"
$ac_includes_default
#include <string>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_header_compiler=yes
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
ac_header_compiler=no
fi
rm -f conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6
# Is the header present?
echo "$as_me:$LINENO: checking string presence" >&5
echo $ECHO_N "checking string presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"
#include <string>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
egrep -v '^ *\+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_cxx_preproc_warn_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
ac_header_preproc=yes
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6
# So? What about this header?
case $ac_header_compiler:$ac_header_preproc in
yes:no )
{ echo "$as_me:$LINENO: WARNING: string: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: string: accepted by the compiler, rejected by the preprocessor!" >&2;}
{ echo "$as_me:$LINENO: WARNING: string: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: string: proceeding with the preprocessor's result" >&2;};;
no:yes )
{ echo "$as_me:$LINENO: WARNING: string: present but cannot be compiled" >&5
echo "$as_me: WARNING: string: present but cannot be compiled" >&2;}
{ echo "$as_me:$LINENO: WARNING: string: check for missing prerequisite headers?" >&5
echo "$as_me: WARNING: string: check for missing prerequisite headers?" >&2;}
{ echo "$as_me:$LINENO: WARNING: string: proceeding with the preprocessor's result" >&5
echo "$as_me: WARNING: string: proceeding with the preprocessor's result" >&2;};;
esac
echo "$as_me:$LINENO: checking for string" >&5
echo $ECHO_N "checking for string... $ECHO_C" >&6
if test "${ac_cv_header_string+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_cv_header_string=$ac_header_preproc
fi
echo "$as_me:$LINENO: result: $ac_cv_header_string" >&5
echo "${ECHO_T}$ac_cv_header_string" >&6
fi
if test $ac_cv_header_string = yes; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_CXX_STRING_HEADER 1
_ACEOF
else
echo "$as_me:$LINENO: checking for class string in <string.h>" >&5
echo $ECHO_N "checking for class string in <string.h>... $ECHO_C" >&6
if test "${pgac_cv_class_string_in_string_h+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef F77_DUMMY_MAIN
# ifdef __cplusplus
extern "C"
# endif
int F77_DUMMY_MAIN() { return 1; }
#endif
int
main ()
{
string foo = "test"
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
pgac_cv_class_string_in_string_h=yes
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
pgac_cv_class_string_in_string_h=no
fi
rm -f conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $pgac_cv_class_string_in_string_h" >&5
echo "${ECHO_T}$pgac_cv_class_string_in_string_h" >&6
if test x"$pgac_cv_class_string_in_string_h" != xyes ; then
{ { echo "$as_me:$LINENO: error: neither <string> nor <string.h> seem to define the C++ class 'string'" >&5
echo "$as_me: error: neither <string> nor <string.h> seem to define the C++ class 'string'" >&2;}
{ (exit 1); exit 1; }; }
fi
fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
echo "$as_me:$LINENO: checking for namespace std in C++" >&5
echo $ECHO_N "checking for namespace std in C++... $ECHO_C" >&6
if test "${pgac_cv_cxx_namespace_std+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_ext=cc
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_CXX_STRING_HEADER
#include <string>
#endif
using namespace std;
#ifdef F77_DUMMY_MAIN
# ifdef __cplusplus
extern "C"
# endif
int F77_DUMMY_MAIN() { return 1; }
#endif
int
main ()
{
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
pgac_cv_cxx_namespace_std=yes
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
pgac_cv_cxx_namespace_std=no
fi
rm -f conftest.$ac_objext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
fi
echo "$as_me:$LINENO: result: $pgac_cv_cxx_namespace_std" >&5
echo "${ECHO_T}$pgac_cv_cxx_namespace_std" >&6
if test $pgac_cv_cxx_namespace_std = yes ; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_NAMESPACE_STD 1
_ACEOF
fi
fi
# Check for Tcl configuration script tclConfig.sh
if test "$with_tcl" = yes; then
for ac_prog in tclsh tcl
@ -17321,12 +16464,6 @@ s,@with_unixodbc@,$with_unixodbc,;t t
s,@with_iodbc@,$with_iodbc,;t t
s,@odbcinst_ini_dir@,$odbcinst_ini_dir,;t t
s,@ELF_SYS@,$ELF_SYS,;t t
s,@CXX@,$CXX,;t t
s,@CXXFLAGS@,$CXXFLAGS,;t t
s,@ac_ct_CXX@,$ac_ct_CXX,;t t
s,@CXXCPP@,$CXXCPP,;t t
s,@with_CXX@,$with_CXX,;t t
s,@GXX@,$GXX,;t t
s,@AWK@,$AWK,;t t
s,@FLEX@,$FLEX,;t t
s,@FLEXFLAGS@,$FLEXFLAGS,;t t

View File

@ -1,5 +1,5 @@
dnl Process this file with autoconf to produce a configure script.
dnl $Header: /cvsroot/pgsql/configure.in,v 1.195 2002/08/20 17:54:43 petere Exp $
dnl $Header: /cvsroot/pgsql/configure.in,v 1.196 2002/08/22 00:15:06 scrappy Exp $
dnl
dnl Developers, please strive to achieve this order:
dnl
@ -243,10 +243,6 @@ AC_SUBST(enable_debug)
# variable.
PGAC_ARG_REQ(with, CC, [], [CC=$with_CC])
# Set here so it can be over-ridden in the template file
GCC_CXXFLAGS="-O2"
VENDOR_CXXFLAGS=""
case $template in
aix) pgac_cc_list="gcc xlc";;
irix) pgac_cc_list="cc";; # no gcc
@ -581,38 +577,6 @@ AC_SUBST(ELF_SYS)
#
# Optionally build C++ code (i.e., libpq++)
#
AC_MSG_CHECKING([whether to build C++ modules])
PGAC_ARG_OPTARG(with, CXX, [ --with-CXX build C++ modules (libpq++)],
[],
[CXX=$withval],
[
AC_MSG_RESULT(yes)
# If the user has specified CXXFLAGS in the environment, leave it
# alone, else use a default.
AC_PROG_CXX
if test "$ac_env_CXXFLAGS" != set; then
if test "$GXX" = yes; then
CXXFLAGS="$GCC_CXXFLAGS"
else
CXXFLAGS="$VENDOR_CXXFLAGS"
fi
fi
if test "$enable_debug" = yes && test "$ac_cv_prog_cxx_g" = yes; then
CXXFLAGS="$CXXFLAGS -g"
fi
AC_MSG_NOTICE([using CXXFLAGS=$CXXFLAGS])
AC_PROG_CXXCPP
],
[AC_MSG_RESULT(no)])
AC_SUBST(with_CXX)
AC_SUBST(GXX)
CPPFLAGS="$CPPFLAGS $INCLUDES"
LDFLAGS="$LDFLAGS $LIBDIRS"
@ -1190,12 +1154,6 @@ if test "$enable_nls" = yes ; then
PGAC_CHECK_GETTEXT
fi
if test "$with_CXX" = yes; then
PGAC_CLASS_STRING
PGAC_CXX_NAMESPACE_STD
fi
# Check for Tcl configuration script tclConfig.sh
if test "$with_tcl" = yes; then
PGAC_PATH_TCLCONFIGSH([$with_tclconfig])

View File

@ -4,7 +4,7 @@
#
# Copyright (c) 1994, Regents of the University of California
#
# $Header: /cvsroot/pgsql/src/interfaces/Makefile,v 1.45 2001/03/09 21:50:27 petere Exp $
# $Header: /cvsroot/pgsql/src/interfaces/Makefile,v 1.46 2002/08/22 00:15:10 scrappy Exp $
#
#-------------------------------------------------------------------------
@ -14,16 +14,12 @@ include $(top_builddir)/src/Makefile.global
DIRS := libpq ecpg libpgeasy
ALLDIRS := $(DIRS) odbc libpq++ libpgtcl perl5 python jdbc
ALLDIRS := $(DIRS) odbc libpgtcl perl5 python jdbc
ifeq ($(enable_odbc), yes)
DIRS += odbc
endif
ifeq ($(with_CXX), yes)
DIRS += libpq++
endif
ifeq ($(with_tcl), yes)
DIRS += libpgtcl
endif

View File

@ -1,32 +0,0 @@
5/18/1999 - vv
---------
* Rewrote libpq++.h
* Incremented shared library version to 3.0
* Cleaned up makefiles
* Made examples use the installed versions of the library and header
4/26/1999 - vv
---------
* Changed PrintTuples and DisplayTuples in PgDatabase to use PQprint()
4/14/1999 - vv
---------
* Changed connection routines to use PQconnectdb()
* Connect now returns CONNECTION_OK or CONNECTION_BAD
* Eliminated pgEnv
* Changed error handler to return proper messages
* New function LOid() returns Large Object ID
* New function Status() returns Large Object Status

View File

@ -1,67 +0,0 @@
#-------------------------------------------------------------------------
#
# Makefile for libpq++ library
#
# Copyright (c) 1994, Regents of the University of California
#
# $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/Makefile,v 1.30 2001/05/22 11:24:28 momjian Exp $
#
#-------------------------------------------------------------------------
subdir = src/interfaces/libpq++
top_builddir = ../../..
include $(top_builddir)/src/Makefile.global
NAME= pq++
SO_MAJOR_VERSION= 4
SO_MINOR_VERSION= 0
override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS)
OBJS = pgconnection.o pgdatabase.o pgtransdb.o pgcursordb.o pglobject.o
SHLIB_LINK= $(libpq)
# communicate with Makefile.shlib
cplusplus := yes
all: all-lib
# Shared library stuff
include $(top_srcdir)/src/Makefile.shlib
.PHONY: examples
examples:
$(MAKE) -C examples all
install: all installdirs install-headers install-lib
libpqxx_includedir = $(includedir)/libpq++
MAINHEADER = libpq++.h
LIBPGXXHEADERS = pgconnection.h pgdatabase.h pgtransdb.h pgcursordb.h pglobject.h
.PHONY: install-headers
install-headers: $(MAINHEADER) $(LIBPGXXHEADERS)
$(INSTALL_DATA) $< $(DESTDIR)$(includedir)
for i in $(LIBPGXXHEADERS); do $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(libpqxx_includedir) || exit 1; done
installdirs:
$(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir) $(DESTDIR)$(libpqxx_includedir)
uninstall: uninstall-lib
rm -f $(DESTDIR)$(includedir)/$(MAINHEADER)
for i in $(LIBPGXXHEADERS); do rm -f $(DESTDIR)$(libpqxx_includedir)/$$i || exit; done
clean distclean maintainer-clean: clean-lib
rm -f $(OBJS)
-$(MAKE) -C examples clean
dep depend:
$(CXX) -MM $(CPPFLAGS) $(CXXFLAGS) *.cc >depend
ifeq (depend,$(wildcard depend))
include depend
endif

View File

@ -1,25 +0,0 @@
Based on the original work by William Wanders (wwanders@sci.kun.nl)
and Jolly Chen (jolly@cs.berkeley.edu), this is the first set of
changes to libpq++ since ~1997. Pgenv has been removed, deprecated
functions removed and/or updated and error handling rewritten,
however for the most part it remains as a wrapper around libpq.
The documentation on libpq is recommended reading to understand
the function of libpq++.
The API provided herein is subject to change in later versions of
PostgreSQL.
For details on how to to use libpq++, see Section 3 in Part 1 of
the PostgreSQL Developer's Guide and the test programs in the
examples/ subdirectory.
** PgConnection has been changed to accept either the environment
variables or conninfo style strings. See the PQconnectdb in the
documentation on libpq for details.
libpq++ has only been tested with g++, version 2.7.2.1
Vince Vielhaber (vev@michvhf.com)
Tue May 18 08:30:00 EDT 1999

View File

@ -1,4 +0,0 @@
* Implement exceptions
* Many other things I have yet to discover

View File

@ -1,36 +0,0 @@
#-------------------------------------------------------------------------
#
# Makefile for libpq++ examples
#
# Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
#
# $Header: /cvsroot/pgsql/src/interfaces/libpq++/examples/Attic/Makefile,v 1.15 2002/07/27 20:10:05 petere Exp $
#
#-------------------------------------------------------------------------
subdir = src/interfaces/libpq++/examples
top_builddir = ../../../..
include $(top_builddir)/src/Makefile.global
LIBNAME= libpq++
HEADERDIR= $(includedir)
LIBPQDIR= $(libdir)
CXXFLAGS= $(CFLAGS)
CXXFLAGS+= -I$(HEADERDIR)
LDFLAGS+= -L$(LIBPQDIR) -lpq++
PROGS= testlibpq0 testlibpq1 testlibpq2 testlibpq3 \
testlibpq4 testlibpq5 testlibpq6 testlo
all: $(PROGS)
$(PROGS): % : %.cc
$(CXX) $(CXXFLAGS) -o $@ $@.cc $(LDFLAGS)
clean:
rm -f $(PROGS)

View File

@ -1,53 +0,0 @@
/*-------------------------------------------------------------------------
*
* testlibpq0.c--
* small test program for libpq++,
* small interactive loop where queries can be entered interactively
* and sent to the backend
*
* Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq++/examples/Attic/testlibpq0.cc,v 1.7 2002/07/02 16:32:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include <iostream.h>
#include "libpq++.h"
int main()
{
// Open the connection to the database and make sure it's OK
PgDatabase data("dbname=template1");
if ( data.ConnectionBad() )
{
cout << "Connection was unsuccessful..." << endl
<< "Error message returned: " << data.ErrorMessage() << endl;
return 1;
}
else
cout << "Connection successful... Enter queries below:" << endl;
// Interactively obtain and execute queries
ExecStatusType status;
string buf;
int done = 0;
while (!done)
{
cout << "> ";
cout.flush();
getline(cin, buf);
if ( buf != "" )
if ( (status = data.Exec( buf.c_str() )) == PGRES_TUPLES_OK )
data.DisplayTuples();
else
cout << "No tuples returned..." << endl
<< "status = " << status << endl
<< "Error returned: " << data.ErrorMessage() << endl;
else
done = 1;
}
return 0;
} // End main()

View File

@ -1,73 +0,0 @@
/*
* testlibpq1.cc
* Test the C++ version of LIBPQ, the POSTGRES frontend library.
*
* queries the template1 database for a list of database names
*
*/
#include <iostream.h>
#include <iomanip.h>
#include "libpq++.h"
int main()
{
// Begin, by establishing a connection to the backend.
// When no parameters are given then the system will
// try to use reasonable defaults by looking up environment variables
// or, failing that, using hardwired constants
const char* dbName = "dbname=template1";
PgDatabase data(dbName);
// check to see that the backend connection was successfully made
if ( data.ConnectionBad() )
{
cerr << "Connection to database '" << dbName << "' failed." << endl
<< "Error returned: " << data.ErrorMessage() << endl;
exit(1);
}
// start a transaction block
if ( !data.ExecCommandOk("BEGIN") )
{
cerr << "BEGIN command failed" << endl;
exit(1);
}
// submit command to the backend
if ( !data.ExecCommandOk("DECLARE myportal CURSOR FOR select * from pg_database") )
{
cerr << "DECLARE CURSOR command failed" << endl;
exit(1);
}
// fetch instances from the pg_database, the system catalog of databases
if ( !data.ExecTuplesOk("FETCH ALL in myportal") )
{
cerr << "FETCH ALL command didn't return tuples properly" << endl;
exit(1);
}
// first, print out the attribute names
int nFields = data.Fields();
for (int i = 0; i < nFields; i++)
cout << setiosflags(ios::right) << setw(15) << data.FieldName(i);
cout << endl << endl;
// next, print out the instances
for (int i = 0; i < data.Tuples(); i++)
{
for (int j = 0; j < nFields; j++)
cout << setiosflags(ios::right) << setw(15) << data.GetValue(i, j);
cout << endl;
}
// Close the portal
data.Exec("CLOSE myportal");
// End the transaction
data.Exec("END");
return 0;
}

View File

@ -1,61 +0,0 @@
/*
* testlibpq2.cc
* Test the C++ version of LIBPQ, the POSTGRES frontend library.
*
* queries the template1 database for a list of database names using transaction block
*
*/
#include <iostream.h>
#include <iomanip.h>
#include "libpq++.h"
int main()
{
// Begin, by establishing a connection to the backend.
// When no parameters are given then the system will
// try to use reasonable defaults by looking up environment variables
// or, failing that, using hardwired constants
const char* dbName = "dbname=template1";
PgTransaction data(dbName);
// check to see that the backend connection was successfully made
if ( data.ConnectionBad() )
{
cerr << "Connection to database '" << dbName << "' failed." << endl
<< "Error returned: " << data.ErrorMessage() << endl;
exit(1);
}
// submit command to the backend
if ( !data.ExecCommandOk("DECLARE myportal CURSOR FOR select * from pg_database") )
{
cerr << "DECLARE CURSOR command failed" << endl;
exit(1);
}
// fetch instances from the pg_database, the system catalog of databases
if ( !data.ExecTuplesOk("FETCH ALL in myportal") )
{
cerr << "FETCH ALL command didn't return tuples properly" << endl;
exit(1);
}
// first, print out the attribute names
int nFields = data.Fields();
for (int i = 0; i < nFields; i++)
cout << setiosflags(ios::right) << setw(15) << data.FieldName(i);
cout << endl << endl;
// next, print out the instances
for (int i = 0; i < data.Tuples(); i++)
{
for (int j = 0; j < nFields; j++)
cout << setiosflags(ios::right) << setw(15) << data.GetValue(i, j);
cout << endl;
}
// close the portal
data.Exec("CLOSE myportal");
return 0;
}

View File

@ -1,5 +0,0 @@
CREATE TABLE TBL1 (i int4);
CREATE TABLE TBL2 (i int4);
CREATE RULE r1 AS ON INSERT TO TBL1 DO [INSERT INTO TBL2 values (new.i); NOTIFY TBL2];

View File

@ -1,61 +0,0 @@
/*
* testlibpq3.cc
* Test the C++ version of LIBPQ, the POSTGRES frontend library.
*
* queries the template1 database for a list of database names using transaction block
* and cursor interface.
*
*/
#include <iostream.h>
#include <iomanip.h>
#include "libpq++.h"
int main()
{
// Begin, by establishing a connection to the backend.
// When no parameters are given then the system will
// try to use reasonable defaults by looking up environment variables
// or, failing that, using hardwired constants.
// Create a cursor database query object.
// All queries using cursor will be performed through this object.
const char* dbName = "dbname=template1";
PgCursor cData(dbName, "myportal");
// check to see that the backend connection was successfully made
if ( cData.ConnectionBad() )
{
cerr << "Connection to database '" << dbName << "' failed." << endl
<< "Error returned: " << cData.ErrorMessage() << endl;
exit(1);
}
// submit command to the backend
if ( !cData.Declare("select * from pg_database") )
{
cerr << "DECLARE CURSOR command failed" << endl;
exit(1);
}
// fetch instances from the pg_cDatabase, the system catalog of cDatabases
if ( !cData.Fetch() )
{
cerr << "FETCH ALL command didn't return tuples properly" << endl;
exit(1);
}
// first, print out the attribute names
int nFields = cData.Fields();
for (int i = 0; i < nFields; i++)
cout << setiosflags(ios::right) << setw(15) << cData.FieldName(i);
cout << endl << endl;
// next, print out the instances
for (int i = 0; i < cData.Tuples(); i++)
{
for (int j = 0; j < nFields; j++)
cout << setiosflags(ios::right) << setw(15) << cData.GetValue(i, j);
cout << endl;
}
return 0;
}

View File

@ -1,6 +0,0 @@
CREATE TABLE test1 (i int4, d float4, p polygon);
INSERT INTO test1 values (1, 3.567, '(3.0, 4.0, 1.0, 2.0)'::polygon);
INSERT INTO test1 values (2, 89.05, '(4.0, 3.0, 2.0, 1.0)'::polygon);

View File

@ -1,63 +0,0 @@
/*
* testlibpq4.cc
* Test of the asynchronous notification interface
*
populate a test database with the following (use testlibpq4.sql):
CREATE TABLE TBL1 (i int4);
CREATE TABLE TBL2 (i int4);
CREATE RULE r1 AS ON INSERT TO TBL1 DO [INSERT INTO TBL2 values (new.i); NOTIFY TBL2];
* Then start up this program
* After the program has begun, do
INSERT INTO TBL1 values (10);
*
*
*/
#include <iostream.h>
#include "libpq++.h"
#include <stdlib.h>
int main()
{
// Begin, by connecting to the backend using hardwired constants
// and a test database created by the user prior to the invokation
// of this test program.
const char* dbName = "dbname=template1";
PgDatabase data(dbName);
// Check to see that the backend connection was successfully made
if ( data.ConnectionBad() )
{
cerr << "Connection to database '" << dbName << "' failed." << endl
<< data.ErrorMessage() << endl;
exit(1);
}
// Listen to a table
if ( !data.ExecCommandOk("LISTEN TBL2") )
{
cerr << "LISTEN command failed" << endl;
exit(1);
}
// Test asynchronous notification
while (1)
{
// check for asynchronous returns
PGnotify* notify = data.Notifies();
if (notify)
{
cerr << "ASYNC NOTIFY of '" << notify->relname
<< "' from backend pid '" << notify->be_pid
<< "' received" << endl;
free(notify);
break;
}
}
return 0;
}

View File

@ -1,5 +0,0 @@
CREATE TABLE TBL1 (i int4);
CREATE TABLE TBL2 (i int4);
CREATE RULE r1 AS ON INSERT TO TBL1 DO (INSERT INTO TBL2 values (new.i); NOTIFY TBL2);

View File

@ -1,108 +0,0 @@
/*
* testlibpq5.cc
* Test the C++ version of LIBPQ, the POSTGRES frontend library.
* tests the binary cursor interface
*
*
*
populate a database by doing the following (use testlibpq5.sql):
CREATE TABLE test1 (i int4, d float4, p polygon);
INSERT INTO test1 values (1, 3.567, '(3.0, 4.0, 1.0, 2.0)'::polygon);
INSERT INTO test1 values (2, 89.05, '(4.0, 3.0, 2.0, 1.0)'::polygon);
the expected output is:
tuple 0: got
i = (4 bytes) 1,
d = (4 bytes) 3.567000,
p = (4 bytes) 2 points boundbox = (hi=3.000000/4.000000, lo = 1.000000,2.000000)
tuple 1: got
i = (4 bytes) 2,
d = (4 bytes) 89.050003,
p = (4 bytes) 2 points boundbox = (hi=4.000000/3.000000, lo = 2.000000,1.000000)
*
*/
#include <iostream.h>
#include "libpq++.h"
#include <stdlib.h>
extern "C"
{
#include "postgres.h" // for Postgres types
#include "utils/geo_decls.h" // for the POLYGON type
}
int main()
{
// Begin, by connecting to the backend using hardwired constants
// and a test database created by the user prior to the invokation
// of this test program. Connect using cursor interface.
const char* dbName = "dbname=template1"; // change this to the name of your test database
PgCursor data(dbName, "mycursor");
// check to see that the backend connection was successfully made
if ( data.ConnectionBad() )
{
cerr << "Connection to database '" << dbName << "' failed." << endl
<< data.ErrorMessage();
exit(1);
}
// Declare a binary cursor for all the tuples in database 'test1'
if ( !data.Declare("select * from test1", 1) )
{
cerr << "DECLARE CURSOR command failed" << endl;
exit(1);
}
// fetch all instances from the current cursor
if ( !data.Fetch() )
{
cerr << "FETCH ALL command didn't return tuples properly" << endl;
exit(1);
}
// Find the field numbers for the columns 'i', 'd', and 'p'
int i_fnum = data.FieldNum("i");
int d_fnum = data.FieldNum("d");
int p_fnum = data.FieldNum("p");
/*
for (i=0;i<3;i++) {
printf("type[%d] = %d, size[%d] = %d\n",
i, data.FieldType(i),
i, data.FieldSize(i));
}
*/
// Print out the information about the extracted tuple
for (int i = 0; i < data.Tuples(); i++)
{
// we hard-wire this to the 3 fields we know about
int* ival = (int*)data.GetValue(i, i_fnum);
float* dval = (float*)data.GetValue(i, d_fnum);
int plen = data.GetLength(i, p_fnum);
// Allocate correct memory space for the Polygon struct and copy
// the extracted data into it.
// plen doesn't include the length field so need to increment by VARHDSZ
POLYGON* pval = (POLYGON*) malloc(plen + VARHDRSZ);
pval->size = plen;
memmove((char*)&pval->npts, data.GetValue(i, p_fnum), plen);
// Display Polygon Information
cout << "tuple " << i << ": got" << endl
<< " i = (" << data.GetLength(i, i_fnum) << " bytes) " << *ival << "," << endl
<< " d = (" << data.GetLength(i, d_fnum) << " bytes) " << *dval << "," << endl
<< " p = (" << data.GetLength(i, d_fnum) << " bytes) " << pval->npts << " points"
<< "\tboundbox = (hi=" << pval->boundbox.high.x << "/" << pval->boundbox.high.y << ","
<< "lo = " << pval->boundbox.low.x << "," << pval->boundbox.low.y << ")" << endl;
// Deallocate memory allocated for the Polygon structure
free(pval);
}
return 0;
}

View File

@ -1,6 +0,0 @@
CREATE TABLE test1 (i int4, d float4, p polygon);
INSERT INTO test1 values (1, 3.567, '(3.0, 4.0, 1.0, 2.0)'::polygon);
INSERT INTO test1 values (2, 89.05, '(4.0, 3.0, 2.0, 1.0)'::polygon);

View File

@ -1,68 +0,0 @@
/*
* testlibpq4.cc
* Test the C++ version of LIBPQ, the POSTGRES frontend library.
* tests the copy in features
*
*/
#include <iostream.h>
#include "libpq++.h"
#include <stdlib.h>
int main()
{
// Begin, by connecting to the backend using hardwired constants
// and a test database created by the user prior to the invokation
// of this test program. Connect using transaction interface.
const char* dbName = "dbname=template1";
PgTransaction data(dbName);
// check to see that the backend connection was successfully made
if ( data.ConnectionBad() )
{
cerr << "Connection to database '" << dbName << "' failed." << endl
<< data.ErrorMessage();
exit(1);
}
else
cout << "Connected to database '" << dbName << "'..." << endl;
// Create a new table
if ( !data.ExecCommandOk("CREATE TABLE foo (a int4, b char(16), d float8)") )
{
cerr << "CREATE TABLE foo command failed" << endl;
exit(1);
}
else
cout << "CREATEd TABLE foo successfully.." << endl;
// Initiate Copy command
if ( data.ExecCommandOk("COPY foo FROM STDIN") )
{
cerr << "COPY foo FROM STDIN" << endl;
exit(1);
}
else
cout << "COPY foo FROM STDIN was successful.." << endl;
// Put some test data into the table
data.PutLine("3\thello world\t4.5\n");
cout << "Line: \"3\thello world\t4.5\" copied..." << endl;
data.PutLine("4\tgoodbye word\t7.11\n");
cout << "Line: \"4\tgoodbye word\t7.11\" copied..." << endl;
data.PutLine("\\.\n");
cout << "Line: \"\\.\" copied..." << endl;
if ( !data.EndCopy() )
cout << "Ended COPY succesfully..." << endl;
else
cerr << "End Copy failed..." << endl;
// Print the data that was inserted into the table
if ( data.ExecTuplesOk("SELECT * FROM foo") )
data.PrintTuples();
else
cerr << "SELECT * FROM foo failed..." << endl;
// Drop the test table
data.Exec("DROP TABLE foo");
return 0;
}

View File

@ -1,52 +0,0 @@
/*-------------------------------------------------------------------------
*
* lotest.cc--
* test using large objects with libpq
*
* Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq++/examples/Attic/testlo.cc,v 1.9 2002/07/02 16:32:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include <iostream.h>
#include "libpq++.h"
#include <stdlib.h>
int main(int argc, char **argv)
{
// Check if the program was invoked correctly; if not, signal error
if (argc < 4 || argc > 5)
{
cerr << "Usage: " << argv[0] << " conninfo_str in_filename out_filename [oid]" << endl;
exit(1);
}
// Get the arguments passed to the program
char* conninfo = argv[1];
char* in_filename = argv[2];
char* out_filename = argv[3];
// Set up the connection and create a large object
int lobjId = ( argc == 4 ? 0 : atoi(argv[4]) );
PgLargeObject object(lobjId, conninfo);
// check to see that the backend connection was successfully made
if ( object.ConnectionBad() )
{
cerr << "Connection with conninfo '" << conninfo << "' failed." << endl
<< object.ErrorMessage();
exit(1);
}
// Test the import and export features of the Large Object interface
object.Exec("BEGIN");
cout << "Importing file \"" << in_filename << "\"..." << endl;
object.Import(in_filename);
cout << "Exporting large object to file \"" << out_filename << "\"..." << endl;
object.Export(out_filename);
object.Exec("END"); // WHY DOES IT CORE DUMP HERE ???
return 0;
}

View File

@ -1,36 +0,0 @@
/*-------------------------------------------------------------------------
*
* libpq++.h
*
*
* DESCRIPTION
* C++ client interface to Postgres
* used for building front-end applications
*
* NOTES
* This is intended to be included by client applications.
* It will not work as an inclusion in the libpq++ sources, since
* in the build environment the individual include files are not
* yet installed in a subdirectory.
*
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: libpq++.h,v 1.13 2002/07/02 16:32:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef LIBPQXX_H
#define LIBPQXX_H
#include <string.h>
#include "libpq++/pgconnection.h"
#include "libpq++/pgdatabase.h"
#include "libpq++/pglobject.h"
#include "libpq++/pgtransdb.h"
#include "libpq++/pgcursordb.h"
#endif /* LIBPQXX_H */

View File

@ -1,34 +0,0 @@
#include <winver.h>
VS_VERSION_INFO VERSIONINFO
FILEVERSION 7,2,0,0
PRODUCTVERSION 7,2,0,0
FILEFLAGSMASK 0x3fL
FILEFLAGS 0x0L
FILEOS 0x40004L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "Comments", "\0"
VALUE "CompanyName", " \0"
VALUE "FileDescription", "PostgreSQL C++ Access Library\0"
VALUE "FileVersion", "7, 2, 0, 0\0"
VALUE "InternalName", "libpq++\0"
VALUE "LegalCopyright", "Copyright © 2000\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "libpq++.dll\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "PostgreSQL\0"
VALUE "ProductVersion", "7, 2, 0, 0\0"
VALUE "SpecialBuild", "\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END

View File

@ -1,160 +0,0 @@
/*-------------------------------------------------------------------------
*
* FILE
* pgconnection.cc
*
* DESCRIPTION
* implementation of the PgConnection class.
* PgConnection encapsulates a frontend to backend connection
*
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/pgconnection.cc,v 1.15 2002/07/02 16:32:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include "pgconnection.h"
#ifdef HAVE_NAMESPACE_STD
using namespace std;
#endif
// ****************************************************************
//
// PgConnection Implementation
//
// ****************************************************************
// default constructor -- initialize everything
PgConnection::PgConnection()
: pgConn(NULL), pgResult(NULL), pgCloseConnection(false)
{}
// constructor -- checks environment variable for database name
// Now uses PQconnectdb
PgConnection::PgConnection(const char* conninfo)
: pgConn(NULL), pgResult(NULL), pgCloseConnection(true)
{
// Connect to the database
Connect(conninfo);
}
// destructor - closes down the connection and cleanup
PgConnection::~PgConnection()
{
// Close the connection only if needed
// This feature will most probably be used by the derived classes that
// need not close the connection after they are destructed.
CloseConnection();
}
// PgConnection::CloseConnection()
// close down the connection if there is one
void PgConnection::CloseConnection()
{
// if the connection is open, close it first
if (pgCloseConnection)
{
if (pgResult)
PQclear(pgResult);
pgResult = NULL;
if (pgConn)
PQfinish(pgConn);
pgConn = NULL;
pgCloseConnection = false;
}
}
// PgConnection::connect
// establish a connection to a backend
ConnStatusType PgConnection::Connect(const char conninfo[])
{
// if the connection is open, close it first
CloseConnection();
// Connect to the database
pgConn = PQconnectdb(conninfo);
// Now we have a connection we must close (even if it's bad!)
pgCloseConnection = true;
// Status will return either CONNECTION_OK or CONNECTION_BAD
return Status();
}
// PgConnection::status -- return connection or result status
ConnStatusType PgConnection::Status() const
{
return PQstatus(pgConn);
}
// PgConnection::exec -- send a query to the backend
ExecStatusType PgConnection::Exec(const char* query)
{
// Clear the result stucture if needed
if (pgResult)
PQclear(pgResult);
// Execute the given query
pgResult = PQexec(pgConn, query);
// Return the status
if (pgResult)
return PQresultStatus(pgResult);
else
return PGRES_FATAL_ERROR;
}
// Return true if the Postgres command was executed OK
int PgConnection::ExecCommandOk(const char* query)
{
return Exec(query) == PGRES_COMMAND_OK;
}
int PgConnection::ExecTuplesOk(const char* query)
{
return Exec(query) == PGRES_TUPLES_OK;
}
// Don't know why these next two need to be part of Connection
// PgConnection::notifies() -- returns a notification from a list of unhandled notifications
PGnotify* PgConnection::Notifies()
{
return PQnotifies(pgConn);
}
// From Integer To String Conversion Function
string PgConnection::IntToString(int n)
{
char buffer [4*sizeof(n) + 2];
sprintf(buffer, "%d", n);
return buffer;
}
bool PgConnection::ConnectionBad() const
{
return Status() == CONNECTION_BAD;
}
const char* PgConnection::ErrorMessage() const
{
return (const char *)PQerrorMessage(pgConn);
}
const char* PgConnection::DBName() const
{
return (const char *)PQdb(pgConn);
}
PQnoticeProcessor PgConnection::SetNoticeProcessor(PQnoticeProcessor proc, void *arg)
{
return PQsetNoticeProcessor(pgConn, proc, arg);
}

View File

@ -1,106 +0,0 @@
/*-------------------------------------------------------------------------
*
* pgconnection.h
*
*
* DESCRIPTION
* Postgres Connection Class:
* Manage Postgres backend connection
*
* NOTES
* Currently under construction.
*
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: pgconnection.h,v 1.19 2002/07/02 16:32:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef PGCONNECTION_H
#define PGCONNECTION_H
extern "C"
{
#include "pg_config.h"
}
/* We assume that the C++ compiler will have these keywords, even though
* pg_config.h may have #define'd them to empty because the C compiler doesn't.
*/
#undef const
#undef inline
#undef signed
#undef volatile
#ifdef HAVE_CXX_STRING_HEADER
#include <string>
#endif
extern "C"
{
#include "libpq-fe.h"
}
#ifdef HAVE_NAMESPACE_STD
#define PGSTD std::
#else
#define PGSTD
#endif
// ****************************************************************
//
// PgConnection - a connection made to a postgres backend
//
// ****************************************************************
// This class contains all the information about the connection
// to the backend process. All the database classes should be
// derived from this class to obtain the connection interface.
class DLLIMPORT PgConnection
{
protected:
PGconn* pgConn; // Connection Structure
PGresult* pgResult; // Current Query Result
bool pgCloseConnection; // true if connection should be closed by destructor
public:
explicit PgConnection(const char* conninfo); // use reasonable & environment defaults
virtual ~PgConnection(); // close connection and clean up
// Connection status and error messages
ConnStatusType Status() const;
bool ConnectionBad() const;
const char* ErrorMessage() const;
// returns the database name of the connection
const char* DBName() const;
// Query Execution interface
ExecStatusType Exec(const char* query); // send a query to the backend
int ExecCommandOk(const char* query); // send a command and check if it's OK
int ExecTuplesOk(const char* query); // send a command and check if tuples are returned
PGnotify* Notifies();
// set the notice processor
PQnoticeProcessor SetNoticeProcessor(PQnoticeProcessor proc, void *arg);
protected:
ConnStatusType Connect(const char* conninfo);
void CloseConnection();
static PGSTD string IntToString(int);
// Default constructor is only available to subclasses
PgConnection();
private:
// We don't support copying of PgConnection objects,
// so make copy constructor and assignment op private.
PgConnection(const PgConnection&);
PgConnection& operator= (const PgConnection&);
};
#undef PGSTD
#endif // PGCONNECTION_H

View File

@ -1,91 +0,0 @@
/*-------------------------------------------------------------------------
*
* FILE
* pgcursordb.cpp
*
* DESCRIPTION
* implementation of the PgCursor class.
* PgCursor encapsulates a cursor interface to the backend
*
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/pgcursordb.cc,v 1.8 2002/07/02 16:32:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include "pgcursordb.h"
#ifdef HAVE_NAMESPACE_STD
using namespace std;
#endif
// ****************************************************************
//
// PgCursor Implementation
//
// ****************************************************************
// Make a connection to the specified database with default environment
// See PQconnectdb() for conninfo usage
PgCursor::PgCursor(const char* conninfo, const char* cursor)
: PgTransaction(conninfo), pgCursor(cursor)
{}
// Do not make a connection to the backend -- just query
// Connection should not be closed after the object destructs since some
// other object is using the connection
//PgCursor::PgCursor(const PgConnection& conn, const char* cursor)
// : PgTransaction(conn), pgCursor(cursor)
//{}
// Destructor: End the transaction block
PgCursor::~PgCursor()
{
Close();
}
// ****************************************************************
//
// PgCursor: Cursor Interface Implementation
//
// ****************************************************************
// Declare a cursor: name has already been supplied in the constructor
int PgCursor::Declare(string query, bool binary)
{
string cmd = "DECLARE " + pgCursor;
if ( binary )
cmd += " BINARY";
cmd += " CURSOR FOR " + query;
return ExecCommandOk( cmd.c_str() );
}
// Fetch ALL tuples in given direction
int PgCursor::Fetch(const char* dir)
{
return Fetch("ALL", dir);
}
// Fetch specified amount of tuples in given direction
int PgCursor::Fetch(unsigned num, const char* dir)
{
return Fetch( IntToString(num), dir );
}
// Create and execute the actual fetch command with the given arguments
int PgCursor::Fetch(string num, string dir)
{
string cmd = "FETCH " + dir + " " + num + " IN " + pgCursor;
return ExecTuplesOk( cmd.c_str() );
}
// Close the cursor: no more queries using the cursor should be allowed
// Actually, the backend should take care of it.
int PgCursor::Close()
{
string cmd = "CLOSE " + pgCursor;
return ExecCommandOk( cmd.c_str() );
}

View File

@ -1,93 +0,0 @@
/*-------------------------------------------------------------------------
*
* pgcursordb.h
*
*
* DESCRIPTION
* Postgres Cursor Database Class:
* Query Postgres backend using a cursor
*
* NOTES
* Currently under construction.
*
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $Id: pgcursordb.h,v 1.12 2002/07/02 16:32:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef PGCURSORDB_H
#define PGCURSORDB_H
#ifndef PGTRANSDB_H
#include "pgtransdb.h"
#endif
#ifdef HAVE_NAMESPACE_STD
#define PGSTD std::
#else
#define PGSTD
#endif
// ****************************************************************
//
// PgCursor - a class for querying databases using a cursor
//
// ****************************************************************
// This is the database access class that declares a cursor and
// manipulates data through it. The interface will introduce some
// ease of use through the methods that will allow cursor specific
// operations, like fetch, forward, etc.
class DLLIMPORT PgCursor : public PgTransaction
{
public:
PgCursor(const char* conninfo, const char* cursor); // use reasonable & environment defaults
// connect to the database with given environment and database name
// PgCursor(const PgConnection&, const char* cursor);
~PgCursor(); // close connection and clean up
// Commands associated with cursor interface
int Declare(PGSTD string query, bool binary = false); // Declare a cursor with given name
int Fetch(const char* dir = "FORWARD"); // Fetch ALL tuples in given direction
int Fetch(unsigned num, const char* dir = "FORWARD"); // Fetch specified amount of tuples
int Close(); // Close the cursor
// Accessors to the cursor name
const char* Cursor() const
{
return pgCursor.c_str();
}
// TODO: Setter has same name as getter--ouch!
// OBSOLESCENT
void Cursor(PGSTD string cursor)
{
pgCursor = cursor;
}
protected:
int Fetch(PGSTD string num, PGSTD string dir);
protected:
PGSTD string pgCursor;
protected:
PgCursor() : PgTransaction()
{} // Do not connect
private:
// We don't support copying of PgCursor objects,
// so make copy constructor and assignment op private.
PgCursor(const PgCursor&);
PgCursor& operator= (const PgCursor&);
}
; // End PgCursor Class Declaration
#undef PGSTD
#endif // PGCURSORDB_H

View File

@ -1,181 +0,0 @@
/*-------------------------------------------------------------------------
*
* FILE
* pgdatabase.cpp
*
* DESCRIPTION
* implementation of the PgDatabase class.
* PgDatabase encapsulates some utility routines
*
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/pgdatabase.cc,v 1.13 2002/07/02 16:32:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include "pgdatabase.h"
#ifdef HAVE_NAMESPACE_STD
using namespace std;
#endif
// OBSOLESCENT (uses PQprint(), which is no longer being maintained)
void PgDatabase::DisplayTuples(FILE *out,
bool fillAlign,
const char* fieldSep,
bool printHeader,
bool /* quiet */) const
{
PQprintOpt po;
po.header = printHeader;
po.align = fillAlign;
po.standard = po.html3 = po.expanded = po.pager = 0;
po.fieldSep = (char *) (fieldSep);
po.tableOpt = po.caption = 0;
po.fieldName = 0;
PQprint(out, pgResult, &po);
}
// OBSOLESCENT (uses PQprint(), which is no longer being maintained)
void PgDatabase::PrintTuples(FILE *out,
bool printAttName,
bool terseOutput,
bool fillAlign) const
{
PQprintOpt po;
po.header = printAttName;
po.align = fillAlign;
po.standard = po.html3 = po.expanded = po.pager = 0;
po.tableOpt = po.caption = 0;
po.fieldSep = (char *) (terseOutput ? "" : "|");
po.fieldName = 0;
PQprint(out, pgResult, &po);
}
int PgDatabase::Tuples() const
{
return PQntuples(pgResult);
}
int PgDatabase::CmdTuples() const
{
const char *a = PQcmdTuples(pgResult);
return a[0] ? atoi(a) : -1;
}
// TODO: Make const?
int PgDatabase::Fields()
{
return PQnfields(pgResult);
}
const char* PgDatabase::FieldName(int field_num) const
{
return PQfname(pgResult, field_num);
}
int PgDatabase::FieldNum(const char* field_name) const
{
return PQfnumber(pgResult, field_name);
}
Oid PgDatabase::FieldType(int field_num) const
{
return PQftype(pgResult, field_num);
}
Oid PgDatabase::FieldType(const char* field_name) const
{
return PQftype(pgResult, FieldNum(field_name));
}
int PgDatabase::FieldSize(int field_num) const
{
return PQfsize(pgResult, field_num);
}
int PgDatabase::FieldSize(const char* field_name) const
{
return PQfsize(pgResult, FieldNum(field_name));
}
const char* PgDatabase::GetValue(int tup_num, int field_num) const
{
return PQgetvalue(pgResult, tup_num, field_num);
}
const char* PgDatabase::GetValue(int tup_num, const char* field_name) const
{
return PQgetvalue(pgResult, tup_num, FieldNum(field_name));
}
bool PgDatabase::GetIsNull(int tup_num, int field_num) const
{
return PQgetisnull(pgResult, tup_num, field_num);
}
bool PgDatabase::GetIsNull(int tup_num, const char* field_name) const
{
return PQgetisnull(pgResult, tup_num, FieldNum(field_name));
}
int PgDatabase::GetLength(int tup_num, int field_num) const
{
return PQgetlength(pgResult, tup_num, field_num);
}
int PgDatabase::GetLength(int tup_num, const char* field_name) const
{
return PQgetlength(pgResult, tup_num, FieldNum(field_name));
}
int PgDatabase::GetLine(char str[], int length)
{
return PQgetline(pgConn, str, length);
}
void PgDatabase::PutLine(const char str[])
{
PQputline(pgConn, str);
}
const char* PgDatabase::OidStatus() const
{
return PQoidStatus(pgResult);
}
int PgDatabase::EndCopy()
{
return PQendcopy(pgConn);
}

View File

@ -1,91 +0,0 @@
/*-------------------------------------------------------------------------
*
* pgdatabase.h
*
*
* DESCRIPTION
* Postgres Database Class:
* Query Postgres backend to obtain query results
*
* NOTES
* Currently under construction.
*
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $Id: pgdatabase.h,v 1.14 2002/07/02 16:32:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef PGDATABASE_H
#define PGDATABASE_H
#ifndef PGCONNECTION_H
#include "pgconnection.h"
#endif
// ****************************************************************
//
// PgDatabase - a class for accessing databases
//
// ****************************************************************
// This is the basic database access class. Its interface should
// be used only after a query has been sent to the backend and
// results are being received.
class DLLIMPORT PgDatabase : public PgConnection
{
public:
// connect to the database with conninfo
explicit PgDatabase(const char* conninfo) : PgConnection(conninfo)
{}
~PgDatabase()
{} // close connection and clean up
typedef int size_type;
// query result access
size_type Tuples() const;
size_type CmdTuples() const;
int Fields();
const char* FieldName(int field_num) const;
int FieldNum(const char* field_name) const;
Oid FieldType(int field_num) const;
Oid FieldType(const char* field_name) const;
int FieldSize(int field_num) const;
int FieldSize(const char* field_name) const;
const char* GetValue(size_type tup_num, int field_num) const;
const char* GetValue(size_type tup_num, const char* field_name) const;
bool GetIsNull(size_type tup_num, int field_num) const;
bool GetIsNull(size_type tup_num, const char* field_name) const;
int GetLength(size_type tup_num, int field_num) const;
int GetLength(size_type tup_num, const char* field_name) const;
// OBSOLESCENT (use PQprint()):
void DisplayTuples(FILE *out = 0, bool fillAlign = true,
const char* fieldSep = "|", bool printHeader = true, bool quiet = false) const;
void PrintTuples(FILE *out = 0, bool printAttName = true,
bool terseOutput = false, bool fillAlign = false) const;
// copy command related access
int GetLine(char str[], int length);
void PutLine(const char str[]);
const char* OidStatus() const;
int EndCopy();
protected:
PgDatabase() : PgConnection()
{} // Do not connect
private:
// We don't support copying of PgDatabase objects,
// so make copy constructor and assignment op private.
PgDatabase(const PgDatabase&);
PgDatabase& operator= (const PgDatabase&);
};
#endif // PGDATABASE_H

View File

@ -1,180 +0,0 @@
/*-------------------------------------------------------------------------
*
* FILE
* pglobject.cc
*
* DESCRIPTION
* implementation of the PgLargeObject class.
* PgLargeObject encapsulates a frontend to backend connection
*
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/pglobject.cc,v 1.11 2002/07/02 16:32:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include "pglobject.h"
extern "C"
{
#include "libpq/libpq-fs.h"
}
#ifdef HAVE_NAMESPACE_STD
using namespace std;
#endif
// ****************************************************************
//
// PgLargeObject Implementation
//
// ****************************************************************
// default constructor
// creates a large object in the default database
// See PQconnectdb() for conninfo usage
PgLargeObject::PgLargeObject(const char* conninfo)
: PgConnection(conninfo)
{
Init();
if (! ConnectionBad())
{
Create();
Open();
}
}
// constructor
// open an existing large object in the default database
// See PQconnectdb() for conninfo usage
PgLargeObject::PgLargeObject(Oid lobjId, const char* conninfo)
: PgConnection(conninfo)
{
Init(lobjId);
if (! ConnectionBad())
{
if ( !pgObject )
Create();
Open();
}
}
// destructor -- closes large object
PgLargeObject::~PgLargeObject()
{
Close();
}
// PgLargeObject::Init
// Initialize the variables
void PgLargeObject::Init(Oid lobjId)
{
pgFd = -1;
pgObject = lobjId;
}
// PgLargeObject::create
// create large object and check for errors
void PgLargeObject::Create()
{
// Create the object
pgObject = lo_creat(pgConn, INV_READ | INV_WRITE);
// Check for possible errors
if (!pgObject)
loStatus = "PgLargeObject: can't create large object" ;
else
loStatus = "PgLargeObject: created large object" ;
}
// PgLargeObject::open
// open large object and check for errors
void PgLargeObject::Open()
{
// Close any prior object
Close();
// Open the object
pgFd = lo_open(pgConn, pgObject, INV_READ | INV_WRITE);
// Check for possible errors
string objStr( IntToString(pgObject) );
if (pgFd < 0)
loStatus = "PgLargeObject: can't open large object " + objStr ;
else
loStatus = "PgLargeObject: created and opened large object " + objStr ;
}
// PgLargeObject::unlink
// destroy large object and delete from it from the database
int PgLargeObject::Unlink()
{
// Unlink the object
int temp = lo_unlink(pgConn, pgObject);
// Initialize the large object upon success
if (!temp)
{
Close();
Init();
}
// Return the status
return temp;
}
void PgLargeObject::Close()
{
if (pgFd >= 0)
lo_close(pgConn, pgFd);
pgFd = -1;
}
int PgLargeObject::Read(char* buf, int len)
{
return lo_read(pgConn, pgFd, buf, len);
}
int PgLargeObject::Write(const char* buf, int len)
{
return lo_write(pgConn, pgFd, (char*)buf, len);
}
int PgLargeObject::LSeek(int offset, int whence)
{
return lo_lseek(pgConn, pgFd, offset, whence);
}
int PgLargeObject::Tell() const
{
return lo_tell(pgConn, pgFd);
}
Oid PgLargeObject::Import(const char* filename)
{
return pgObject = lo_import(pgConn, filename);
}
int PgLargeObject::Export(const char* filename)
{
return lo_export(pgConn, pgObject, filename);
}
string PgLargeObject::Status() const
{
return loStatus;
}
Oid PgLargeObject::LOid()
{
return pgObject;
}

View File

@ -1,74 +0,0 @@
/*-------------------------------------------------------------------------
*
* FILE
* pglobject.h
*
* DESCRIPTION
* declaration of the PGlobj class.
* PGlobj encapsulates a large object interface to Postgres backend
*
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $Id: pglobject.h,v 1.11 2002/07/02 16:32:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef PGLOBJECT_H
#define PGLOBJECT_H
#ifndef PGCONNECTION_H
#include "pgconnection.h"
#endif
#ifdef HAVE_NAMESPACE_STD
#define PGSTD std::
#else
#define PGSTD
#endif
// ****************************************************************
//
// PgLargeObject - a class for accessing Large Object in a database
//
// ****************************************************************
class DLLIMPORT PgLargeObject : public PgConnection
{
private:
int pgFd;
Oid pgObject;
PGSTD string loStatus;
void Init(Oid lobjId = 0);
public:
explicit PgLargeObject(const char* conninfo = 0); // use reasonable defaults and create large object
explicit PgLargeObject(Oid lobjId, const char* conninfo = 0); // use reasonable defaults and open large object
~PgLargeObject(); // close connection and clean up
void Create();
void Open();
void Close();
int Read(char* buf, int len);
int Write(const char* buf, int len);
int LSeek(int offset, int whence);
int Tell() const;
int Unlink();
Oid LOid();
Oid Import(const char* filename);
int Export(const char* filename);
PGSTD string Status() const;
private:
// We don't support copying of PgLargeObject objects,
// so make copy constructor and assignment op private.
PgLargeObject(const PgLargeObject&);
PgLargeObject& operator= (const PgLargeObject&);
};
#undef PGSTD
#endif // PGLOBJECT_H

View File

@ -1,54 +0,0 @@
/*-------------------------------------------------------------------------
*
* FILE
* pgtransdb.cpp
*
* DESCRIPTION
* implementation of the PgTransaction class.
* PgConnection encapsulates a transaction querying to backend
*
* Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/pgtransdb.cc,v 1.5 2002/07/02 16:32:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include "pgtransdb.h"
// ****************************************************************
//
// PgTransaction Implementation
//
// ****************************************************************
// Make a connection to the specified database with default environment
// See PQconnectdb() for conninfo usage.
PgTransaction::PgTransaction(const char* conninfo)
: PgDatabase(conninfo),
pgCommitted(true)
{
BeginTransaction();
}
// Destructor: End the transaction block
PgTransaction::~PgTransaction()
{
if (!pgCommitted)
Exec("ABORT");
}
// Begin the transaction block
ExecStatusType PgTransaction::BeginTransaction()
{
pgCommitted = false;
return Exec("BEGIN");
} // End BeginTransaction()
// Begin the transaction block
ExecStatusType PgTransaction::EndTransaction()
{
pgCommitted = true;
return Exec("END");
} // End EndTransaction()

View File

@ -1,64 +0,0 @@
/*-------------------------------------------------------------------------
*
* pgtransdb.h
*
*
* DESCRIPTION
* Postgres Transaction Database Class:
* Query Postgres backend using a transaction block
*
* NOTES
* Currently under construction.
*
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $Id: pgtransdb.h,v 1.11 2002/07/18 04:49:30 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef PGTRANSDB_H
#define PGTRANSDB_H
#ifndef PGDATABASE_H
#include "pgdatabase.h"
#endif
// ****************************************************************
//
// PgTransaction - a class for running transactions against databases
//
// ****************************************************************
// This is the database access class that keeps an open
// transaction block during its lifetime. The block is ABORTed when
// the object is destroyed, unless you call EndTransaction() method
// before destruction of the object.
class DLLIMPORT PgTransaction : public PgDatabase
{
public:
explicit PgTransaction(const char* conninfo); // use reasonable & environment defaults
// connect to the database with given environment and database name
// explicit PgTransaction(const PgConnection&);
~PgTransaction(); // close connection and clean up
ExecStatusType BeginTransaction();
ExecStatusType EndTransaction();
protected:
PgTransaction() : PgDatabase(), pgCommitted(true)
{} // Do not connect
private:
bool pgCommitted;
// We don't support copying of PgTransaction objects,
// so make copy constructor and assignment op private.
PgTransaction(const PgTransaction&);
PgTransaction& operator= (const PgTransaction&);
}
; // End PgTransaction Class Declaration
#endif // PGTRANSDB_H

View File

@ -1,126 +0,0 @@
# Makefile for Microsoft Visual C++ 6.0 (or compat)
# Will build a Win32 static library (non-debug) libpq++.lib
# and a Win32 dynamic library (non-debug) libpq++.dll with import library libpq++dll.lib
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
.SUFFIXES : .cc
CPP=cl.exe
RSC=rc.exe
OUTDIR=.\Release
INTDIR=.\Release
# Begin Custom Macros
OutDir=.\Release
# End Custom Macros
ALL : "$(OUTDIR)\libpq++.dll" "$(OUTDIR)\libpq++.lib"
CLEAN :
-@erase "$(INTDIR)\pgconnection.obj"
-@erase "$(INTDIR)\pgcursordb.obj"
-@erase "$(INTDIR)\pgdatabase.obj"
-@erase "$(INTDIR)\pglobject.obj"
-@erase "$(INTDIR)\pgtransdb.obj"
-@erase "$(OUTDIR)\libpq++.lib"
-@erase "$(OUTDIR)\libpq++.dll"
-@erase "$(OUTDIR)\libpq++dll.exp"
-@erase "$(OUTDIR)\libpq++dll.lib"
-@erase "$(OUTDIR)\libpq++dll.res"
-@erase "*.pch"
-@erase "$(OUTDIR)\libpq++.pch"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP_PROJ=/nologo /TP /MD /W3 /GX /O2 /I "..\..\include" /I "..\libpq" /D "NDEBUG" /D\
"WIN32" /D "_WINDOWS" /Fp"$(INTDIR)\libpq++.pch" /YX\
/Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c /D "HAVE_VSNPRINTF" /D "HAVE_STRDUP"
CPP_OBJS=.\Release/
CPP_SBRS=.
LIB32=link.exe -lib
LIB32_FLAGS=/nologo /out:"$(OUTDIR)\libpq++.lib"
LIB32_OBJS= \
"$(OUTDIR)\pgconnection.obj" \
"$(OUTDIR)\pgcursordb.obj" \
"$(OUTDIR)\pgdatabase.obj" \
"$(OUTDIR)\pglobject.obj" \
"$(OUTDIR)\pgtransdb.obj"
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\libpq++dll.res"
LINK32=link.exe
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib wsock32.lib\
odbccp32.lib libpq.lib msvcrt.lib /nologo /subsystem:windows /dll /incremental:no\
/pdb:"$(OUTDIR)\libpq++.pdb" /machine:I386 /out:"$(OUTDIR)\libpq++.dll"\
/implib:"$(OUTDIR)\libpq++dll.lib" /libpath:"..\libpq\release"
LINK32_OBJS= \
"$(OUTDIR)\pgconnection.obj" \
"$(OUTDIR)\pgcursordb.obj" \
"$(OUTDIR)\pgdatabase.obj" \
"$(OUTDIR)\pglobject.obj" \
"$(OUTDIR)\pgtransdb.obj" \
"$(OUTDIR)\libpq++dll.res"
"$(INTDIR)\libpq++dll.res" : "$(INTDIR)" libpq++dll.rc
$(RSC) $(RSC_PROJ) libpq++dll.rc
"$(OUTDIR)\libpq++.lib" : "$(OUTDIR)" $(LIB32_OBJS)
$(LIB32) @<<
$(LIB32_FLAGS) $(LIB32_OBJS)
<<
"$(OUTDIR)\libpq++.dll" : "$(OUTDIR)" $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
.c{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cc{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cc{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<

View File

@ -1,4 +1,4 @@
# $Header: /cvsroot/pgsql/src/win32.mak,v 1.6 2001/08/24 22:42:28 petere Exp $
# $Header: /cvsroot/pgsql/src/win32.mak,v 1.7 2002/08/22 00:15:08 scrappy Exp $
# Makefile for Microsoft Visual C++ 5.0 (or compat)
# Top-file makefile for Win32 parts of postgresql.
@ -20,8 +20,6 @@ ALL:
cd ..
cd interfaces\libpq
nmake /f win32.mak $(MAKEMACRO)
cd ..\libpq++
nmake /f win32.mak $(MAKEMACRO)
cd ..\..\bin\psql
nmake /f win32.mak $(MAKEMACRO)
cd ..\..