]> git.saurik.com Git - wxWidgets.git/commitdiff
Guess what: ODBC updates and build fixes.
authorRobert Roebling <robert@roebling.de>
Wed, 30 Dec 1998 23:30:49 +0000 (23:30 +0000)
committerRobert Roebling <robert@roebling.de>
Wed, 30 Dec 1998 23:30:49 +0000 (23:30 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1288 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

46 files changed:
configure
include/wx/db.h
include/wx/dbtable.h
samples/db/dbtest.cpp
samples/db/listdb.h
src/common/db.cpp
src/common/dbtable.cpp
src/gtk.inc
src/iodbc/Changes.log
src/iodbc/Makefile
src/iodbc/README
src/iodbc/catalog.c
src/iodbc/config.h
src/iodbc/connect.c
src/iodbc/dlf.c
src/iodbc/dlf.h
src/iodbc/dlproc.c
src/iodbc/dlproc.h
src/iodbc/execute.c
src/iodbc/fetch.c
src/iodbc/hdbc.c
src/iodbc/hdbc.h
src/iodbc/henv.c
src/iodbc/henv.ci
src/iodbc/henv.h
src/iodbc/herr.c
src/iodbc/herr.ci
src/iodbc/herr.h
src/iodbc/hstmt.c
src/iodbc/hstmt.h
src/iodbc/info.c
src/iodbc/isql.h
src/iodbc/isqlext.h
src/iodbc/itrace.c
src/iodbc/itrace.h
src/iodbc/main.c
src/iodbc/misc.c
src/iodbc/odbc_funcs.h [new file with mode: 0644]
src/iodbc/odbc_types.h [new file with mode: 0644]
src/iodbc/postgres/isql.h [deleted file]
src/iodbc/postgres/isqlext.h [deleted file]
src/iodbc/postgres/odbc_funcs.h [deleted file]
src/iodbc/postgres/odbc_types.h [deleted file]
src/iodbc/prepare.c
src/iodbc/result.c
src/iodbc/shrsub.exp

index 19d5a956c241d27d1f344ff3d6ab0ebb25aed9f6..41a42f653a1706f27f90bf447be53bb3fb238e47 100755 (executable)
--- a/configure
+++ b/configure
@@ -648,6 +648,7 @@ WXBASEDIR=`pwd`
 
 SEARCH_INCLUDE="\
     /usr/Motif1.2/include     \
+    /usr/dt/include/Xm        \
                              \
     /usr/X11R6/include        \
     /usr/X11R5/include        \
@@ -700,6 +701,7 @@ SEARCH_INCLUDE="\
     "
 
 SEARCH_LIB="`echo "$SEARCH_INCLUDE" | sed s/include/lib/g` \
+    /usr/dt/lib \
     "
 
 
@@ -707,7 +709,7 @@ SEARCH_LIB="`echo "$SEARCH_INCLUDE" | sed s/include/lib/g` \
 # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:711: checking for $ac_word" >&5
+echo "configure:713: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -736,7 +738,7 @@ if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:740: checking for $ac_word" >&5
+echo "configure:742: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -784,7 +786,7 @@ fi
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:788: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:790: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -794,11 +796,11 @@ ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS
 cross_compiling=$ac_cv_prog_cc_cross
 
 cat > conftest.$ac_ext <<EOF
-#line 798 "configure"
+#line 800 "configure"
 #include "confdefs.h"
 main(){return(0);}
 EOF
-if { (eval echo configure:802: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:804: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   ac_cv_prog_cc_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
@@ -818,12 +820,12 @@ if test $ac_cv_prog_cc_works = no; then
   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:822: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:824: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:827: checking whether we are using GNU C" >&5
+echo "configure:829: checking whether we are using GNU C" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -832,7 +834,7 @@ else
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:836: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:838: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
@@ -847,7 +849,7 @@ if test $ac_cv_prog_gcc = yes; then
   ac_save_CFLAGS="$CFLAGS"
   CFLAGS=
   echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:851: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:853: checking whether ${CC-cc} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -879,10 +881,10 @@ CFLAGS=`echo "$CFLAGS" | sed 's/-g//g'`
 
 if test "x$CC" != xcc; then
   echo $ac_n "checking whether $CC and cc understand -c and -o together""... $ac_c" 1>&6
-echo "configure:883: checking whether $CC and cc understand -c and -o together" >&5
+echo "configure:885: checking whether $CC and cc understand -c and -o together" >&5
 else
   echo $ac_n "checking whether cc understands -c and -o together""... $ac_c" 1>&6
-echo "configure:886: checking whether cc understands -c and -o together" >&5
+echo "configure:888: checking whether cc understands -c and -o together" >&5
 fi
 set dummy $CC; ac_cc="`echo $2 |
                       sed -e 's/[^a-zA-Z0-9_]/_/g' -e 's/^[0-9]/_/'`"
@@ -894,16 +896,16 @@ else
 # We do the test twice because some compilers refuse to overwrite an
 # existing .o file with -o, though they will create one.
 ac_try='${CC-cc} -c conftest.c -o conftest.o 1>&5'
-if { (eval echo configure:898: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } &&
-   test -f conftest.o && { (eval echo configure:899: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; };
+if { (eval echo configure:900: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } &&
+   test -f conftest.o && { (eval echo configure:901: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; };
 then
   eval ac_cv_prog_cc_${ac_cc}_c_o=yes
   if test "x$CC" != xcc; then
     # Test first that cc exists at all.
-    if { ac_try='cc -c conftest.c 1>&5'; { (eval echo configure:904: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
+    if { ac_try='cc -c conftest.c 1>&5'; { (eval echo configure:906: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
       ac_try='cc -c conftest.c -o conftest.o 1>&5'
-      if { (eval echo configure:906: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } &&
-        test -f conftest.o && { (eval echo configure:907: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; };
+      if { (eval echo configure:908: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } &&
+        test -f conftest.o && { (eval echo configure:909: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; };
       then
         # cc works too.
         :
@@ -930,7 +932,7 @@ EOF
 fi
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:934: checking how to run the C preprocessor" >&5
+echo "configure:936: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -945,13 +947,13 @@ else
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 949 "configure"
+#line 951 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:955: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:957: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   :
@@ -962,13 +964,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 966 "configure"
+#line 968 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:972: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:974: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   :
@@ -992,13 +994,13 @@ echo "$ac_t""$CPP" 1>&6
 
 if test $ac_cv_prog_gcc = yes; then
     echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
-echo "configure:996: checking whether ${CC-cc} needs -traditional" >&5
+echo "configure:998: checking whether ${CC-cc} needs -traditional" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
     ac_pattern="Autoconf.*'x'"
   cat > conftest.$ac_ext <<EOF
-#line 1002 "configure"
+#line 1004 "configure"
 #include "confdefs.h"
 #include <sgtty.h>
 Autoconf TIOCGETP
@@ -1016,7 +1018,7 @@ rm -f conftest*
 
   if test $ac_cv_prog_gcc_traditional = no; then
     cat > conftest.$ac_ext <<EOF
-#line 1020 "configure"
+#line 1022 "configure"
 #include "confdefs.h"
 #include <termio.h>
 Autoconf TCGETA
@@ -1045,7 +1047,7 @@ 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 $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1049: checking for $ac_word" >&5
+echo "configure:1051: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1076,7 +1078,7 @@ test -n "$CXX" || CXX="gcc"
 
 
 echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1080: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
+echo "configure:1082: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
 
 ac_ext=C
 # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -1086,11 +1088,11 @@ ac_link='${CXX-g++} -o conftest $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $L
 cross_compiling=$ac_cv_prog_cxx_cross
 
 cat > conftest.$ac_ext <<EOF
-#line 1090 "configure"
+#line 1092 "configure"
 #include "confdefs.h"
 main(){return(0);}
 EOF
-if { (eval echo configure:1094: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1096: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   ac_cv_prog_cxx_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
@@ -1116,12 +1118,12 @@ if test $ac_cv_prog_cxx_works = no; then
   { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:1120: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1122: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6
 cross_compiling=$ac_cv_prog_cxx_cross
 
 echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6
-echo "configure:1125: checking whether we are using GNU C++" >&5
+echo "configure:1127: checking whether we are using GNU C++" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1130,7 +1132,7 @@ else
   yes;
 #endif
 EOF
-if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1134: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:1136: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gxx=yes
 else
   ac_cv_prog_gxx=no
@@ -1145,7 +1147,7 @@ if test $ac_cv_prog_gxx = yes; then
   ac_save_CXXFLAGS="$CXXFLAGS"
   CXXFLAGS=
   echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6
-echo "configure:1149: checking whether ${CXX-g++} accepts -g" >&5
+echo "configure:1151: checking whether ${CXX-g++} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1173,7 +1175,7 @@ else
 fi
 
 echo $ac_n "checking how to run the C++ preprocessor""... $ac_c" 1>&6
-echo "configure:1177: checking how to run the C++ preprocessor" >&5
+echo "configure:1179: checking how to run the C++ preprocessor" >&5
 if test -z "$CXXCPP"; then
 if eval "test \"`echo '$''{'ac_cv_prog_CXXCPP'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1186,12 +1188,12 @@ ac_link='${CXX-g++} -o conftest $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $L
 cross_compiling=$ac_cv_prog_cxx_cross
   CXXCPP="${CXX-g++} -E"
   cat > conftest.$ac_ext <<EOF
-#line 1190 "configure"
+#line 1192 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1195: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1197: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   :
@@ -1223,7 +1225,7 @@ CXXFLAGS=`echo "$CXXFLAGS" | sed 's/-g//g'`
 # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1227: checking for $ac_word" >&5
+echo "configure:1229: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1253,7 +1255,7 @@ fi
 # Extract the first word of "ar", so it can be a program name with args.
 set dummy ar; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1257: checking for $ac_word" >&5
+echo "configure:1259: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1310,7 +1312,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:1314: checking for a BSD compatible install" >&5
+echo "configure:1316: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1361,7 +1363,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
 
 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:1365: checking whether ln -s works" >&5
+echo "configure:1367: checking whether ln -s works" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1387,7 +1389,7 @@ 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 $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1391: checking for $ac_word" >&5
+echo "configure:1393: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1417,7 +1419,7 @@ done
 
 
 echo $ac_n "checking "make for VPATH support"""... $ac_c" 1>&6
-echo "configure:1421: checking "make for VPATH support"" >&5
+echo "configure:1423: checking "make for VPATH support"" >&5
 cat - << EOF > confMake
 check : file
        cp \$? \$@
@@ -1447,7 +1449,7 @@ fi
 # Uses ac_ vars as temps to allow command line to override cache and checks.
 # --without-x overrides everything else, but does not touch the cache.
 echo $ac_n "checking for X""... $ac_c" 1>&6
-echo "configure:1451: checking for X" >&5
+echo "configure:1453: checking for X" >&5
 
 # Check whether --with-x or --without-x was given.
 if test "${with_x+set}" = set; then
@@ -1509,12 +1511,12 @@ if test "$ac_x_includes" = NO; then
 
   # First, try using that file with no special directory specified.
 cat > conftest.$ac_ext <<EOF
-#line 1513 "configure"
+#line 1515 "configure"
 #include "confdefs.h"
 #include <$x_direct_test_include>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1518: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1520: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1583,14 +1585,14 @@ if test "$ac_x_libraries" = NO; then
   ac_save_LIBS="$LIBS"
   LIBS="-l$x_direct_test_library $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1587 "configure"
+#line 1589 "configure"
 #include "confdefs.h"
 
 int main() {
 ${x_direct_test_function}()
 ; return 0; }
 EOF
-if { (eval echo configure:1594: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1596: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   LIBS="$ac_save_LIBS"
 # We can link X programs with no special library path.
@@ -1696,17 +1698,17 @@ else
     case "`(uname -sr) 2>/dev/null`" in
     "SunOS 5"*)
       echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6
-echo "configure:1700: checking whether -R must be followed by a space" >&5
+echo "configure:1702: checking whether -R must be followed by a space" >&5
       ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries"
       cat > conftest.$ac_ext <<EOF
-#line 1703 "configure"
+#line 1705 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:1710: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1712: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   ac_R_nospace=yes
 else
@@ -1722,14 +1724,14 @@ rm -f conftest*
       else
        LIBS="$ac_xsave_LIBS -R $x_libraries"
        cat > conftest.$ac_ext <<EOF
-#line 1726 "configure"
+#line 1728 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:1733: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1735: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   ac_R_space=yes
 else
@@ -1761,7 +1763,7 @@ rm -f conftest*
     # libraries were built with DECnet support.  And karl@cs.umb.edu says
     # the Alpha needs dnet_stub (dnet does not exist).
     echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6
-echo "configure:1765: checking for dnet_ntoa in -ldnet" >&5
+echo "configure:1767: checking for dnet_ntoa in -ldnet" >&5
 ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1769,7 +1771,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldnet  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1773 "configure"
+#line 1775 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1780,7 +1782,7 @@ int main() {
 dnet_ntoa()
 ; return 0; }
 EOF
-if { (eval echo configure:1784: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1786: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1802,7 +1804,7 @@ fi
 
     if test $ac_cv_lib_dnet_dnet_ntoa = no; then
       echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6
-echo "configure:1806: checking for dnet_ntoa in -ldnet_stub" >&5
+echo "configure:1808: checking for dnet_ntoa in -ldnet_stub" >&5
 ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1810,7 +1812,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldnet_stub  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1814 "configure"
+#line 1816 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1821,7 +1823,7 @@ int main() {
 dnet_ntoa()
 ; return 0; }
 EOF
-if { (eval echo configure:1825: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1827: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1850,12 +1852,12 @@ fi
     # The nsl library prevents programs from opening the X display
     # on Irix 5.2, according to dickey@clark.net.
     echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
-echo "configure:1854: checking for gethostbyname" >&5
+echo "configure:1856: checking for gethostbyname" >&5
 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1859 "configure"
+#line 1861 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char gethostbyname(); below.  */
@@ -1878,7 +1880,7 @@ gethostbyname();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1882: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1884: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_gethostbyname=yes"
 else
@@ -1899,7 +1901,7 @@ fi
 
     if test $ac_cv_func_gethostbyname = no; then
       echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:1903: checking for gethostbyname in -lnsl" >&5
+echo "configure:1905: checking for gethostbyname in -lnsl" >&5
 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1907,7 +1909,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1911 "configure"
+#line 1913 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1918,7 +1920,7 @@ int main() {
 gethostbyname()
 ; return 0; }
 EOF
-if { (eval echo configure:1922: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1924: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1948,12 +1950,12 @@ fi
     # -lsocket must be given before -lnsl if both are needed.
     # We assume that if connect needs -lnsl, so does gethostbyname.
     echo $ac_n "checking for connect""... $ac_c" 1>&6
-echo "configure:1952: checking for connect" >&5
+echo "configure:1954: checking for connect" >&5
 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1957 "configure"
+#line 1959 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char connect(); below.  */
@@ -1976,7 +1978,7 @@ connect();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1980: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1982: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_connect=yes"
 else
@@ -1997,7 +1999,7 @@ fi
 
     if test $ac_cv_func_connect = no; then
       echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6
-echo "configure:2001: checking for connect in -lsocket" >&5
+echo "configure:2003: checking for connect in -lsocket" >&5
 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2005,7 +2007,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket $X_EXTRA_LIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2009 "configure"
+#line 2011 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2016,7 +2018,7 @@ int main() {
 connect()
 ; return 0; }
 EOF
-if { (eval echo configure:2020: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2022: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2040,12 +2042,12 @@ fi
 
     # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX.
     echo $ac_n "checking for remove""... $ac_c" 1>&6
-echo "configure:2044: checking for remove" >&5
+echo "configure:2046: checking for remove" >&5
 if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2049 "configure"
+#line 2051 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char remove(); below.  */
@@ -2068,7 +2070,7 @@ remove();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2072: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2074: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_remove=yes"
 else
@@ -2089,7 +2091,7 @@ fi
 
     if test $ac_cv_func_remove = no; then
       echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6
-echo "configure:2093: checking for remove in -lposix" >&5
+echo "configure:2095: checking for remove in -lposix" >&5
 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2097,7 +2099,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lposix  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2101 "configure"
+#line 2103 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2108,7 +2110,7 @@ int main() {
 remove()
 ; return 0; }
 EOF
-if { (eval echo configure:2112: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2114: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2132,12 +2134,12 @@ fi
 
     # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
     echo $ac_n "checking for shmat""... $ac_c" 1>&6
-echo "configure:2136: checking for shmat" >&5
+echo "configure:2138: checking for shmat" >&5
 if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2141 "configure"
+#line 2143 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char shmat(); below.  */
@@ -2160,7 +2162,7 @@ shmat();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2164: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2166: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_shmat=yes"
 else
@@ -2181,7 +2183,7 @@ fi
 
     if test $ac_cv_func_shmat = no; then
       echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6
-echo "configure:2185: checking for shmat in -lipc" >&5
+echo "configure:2187: checking for shmat in -lipc" >&5
 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2189,7 +2191,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lipc  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2193 "configure"
+#line 2195 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2200,7 +2202,7 @@ int main() {
 shmat()
 ; return 0; }
 EOF
-if { (eval echo configure:2204: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2206: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2233,7 +2235,7 @@ fi
   # libraries we check for below, so use a different variable.
   #  --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
   echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6
-echo "configure:2237: checking for IceConnectionNumber in -lICE" >&5
+echo "configure:2239: checking for IceConnectionNumber in -lICE" >&5
 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2241,7 +2243,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lICE  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2245 "configure"
+#line 2247 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2252,7 +2254,7 @@ int main() {
 IceConnectionNumber()
 ; return 0; }
 EOF
-if { (eval echo configure:2256: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2258: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2282,12 +2284,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
-echo "configure:2286: checking for $ac_hdr that defines DIR" >&5
+echo "configure:2288: checking for $ac_hdr that defines DIR" >&5
 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2291 "configure"
+#line 2293 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <$ac_hdr>
@@ -2295,7 +2297,7 @@ int main() {
 DIR *dirp = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:2299: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2301: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   eval "ac_cv_header_dirent_$ac_safe=yes"
 else
@@ -2320,7 +2322,7 @@ done
 # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
 if test $ac_header_dirent = dirent.h; then
 echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
-echo "configure:2324: checking for opendir in -ldir" >&5
+echo "configure:2326: checking for opendir in -ldir" >&5
 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2328,7 +2330,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldir  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2332 "configure"
+#line 2334 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2339,7 +2341,7 @@ int main() {
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:2343: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2345: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2361,7 +2363,7 @@ fi
 
 else
 echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
-echo "configure:2365: checking for opendir in -lx" >&5
+echo "configure:2367: checking for opendir in -lx" >&5
 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2369,7 +2371,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lx  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2373 "configure"
+#line 2375 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2380,7 +2382,7 @@ int main() {
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:2384: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2386: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2403,12 +2405,12 @@ fi
 fi
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:2407: checking for ANSI C header files" >&5
+echo "configure:2409: checking for ANSI C header files" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2412 "configure"
+#line 2414 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -2416,7 +2418,7 @@ else
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2420: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2422: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2433,7 +2435,7 @@ rm -f conftest*
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 2437 "configure"
+#line 2439 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -2451,7 +2453,7 @@ fi
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 2455 "configure"
+#line 2457 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -2472,7 +2474,7 @@ if test "$cross_compiling" = yes; then
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 2476 "configure"
+#line 2478 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -2483,7 +2485,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
 exit (0); }
 
 EOF
-if { (eval echo configure:2487: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2489: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -2507,12 +2509,12 @@ EOF
 fi
 
 echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
-echo "configure:2511: checking for sys/wait.h that is POSIX.1 compatible" >&5
+echo "configure:2513: checking for sys/wait.h that is POSIX.1 compatible" >&5
 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2516 "configure"
+#line 2518 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/wait.h>
@@ -2528,7 +2530,7 @@ wait (&s);
 s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
 ; return 0; }
 EOF
-if { (eval echo configure:2532: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2534: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_sys_wait_h=yes
 else
@@ -2552,17 +2554,17 @@ for ac_hdr in fcntl.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2556: checking for $ac_hdr" >&5
+echo "configure:2558: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2561 "configure"
+#line 2563 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2566: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2568: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2592,17 +2594,17 @@ for ac_hdr in limits.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2596: checking for $ac_hdr" >&5
+echo "configure:2598: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2601 "configure"
+#line 2603 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2606: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2608: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2632,17 +2634,17 @@ for ac_hdr in sys/file.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2636: checking for $ac_hdr" >&5
+echo "configure:2638: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2641 "configure"
+#line 2643 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2646: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2648: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2672,17 +2674,17 @@ for ac_hdr in sys/time.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2676: checking for $ac_hdr" >&5
+echo "configure:2678: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2681 "configure"
+#line 2683 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2686: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2688: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2712,17 +2714,17 @@ for ac_hdr in unistd.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2716: checking for $ac_hdr" >&5
+echo "configure:2718: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2721 "configure"
+#line 2723 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2726: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2728: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2752,17 +2754,17 @@ for ac_hdr in fnmatch.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2756: checking for $ac_hdr" >&5
+echo "configure:2758: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2761 "configure"
+#line 2763 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2766: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2768: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2792,17 +2794,17 @@ for ac_hdr in linux/joystick.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2796: checking for $ac_hdr" >&5
+echo "configure:2798: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2801 "configure"
+#line 2803 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2806: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2808: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2835,12 +2837,12 @@ fi
 
 
 echo $ac_n "checking for vprintf""... $ac_c" 1>&6
-echo "configure:2839: checking for vprintf" >&5
+echo "configure:2841: checking for vprintf" >&5
 if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2844 "configure"
+#line 2846 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char vprintf(); below.  */
@@ -2863,7 +2865,7 @@ vprintf();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2867: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2869: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_vprintf=yes"
 else
@@ -2887,12 +2889,12 @@ fi
 
 if test "$ac_cv_func_vprintf" != yes; then
 echo $ac_n "checking for _doprnt""... $ac_c" 1>&6
-echo "configure:2891: checking for _doprnt" >&5
+echo "configure:2893: checking for _doprnt" >&5
 if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2896 "configure"
+#line 2898 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char _doprnt(); below.  */
@@ -2915,7 +2917,7 @@ _doprnt();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2919: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2921: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func__doprnt=yes"
 else
@@ -2940,12 +2942,12 @@ fi
 fi
 
 echo $ac_n "checking for vsnprintf""... $ac_c" 1>&6
-echo "configure:2944: checking for vsnprintf" >&5
+echo "configure:2946: checking for vsnprintf" >&5
 if eval "test \"`echo '$''{'ac_cv_func_vsnprintf'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2949 "configure"
+#line 2951 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char vsnprintf(); below.  */
@@ -2968,7 +2970,7 @@ vsnprintf();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2972: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2974: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_vsnprintf=yes"
 else
@@ -3000,17 +3002,17 @@ for ac_hdr in iostream
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3004: checking for $ac_hdr" >&5
+echo "configure:3006: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3009 "configure"
+#line 3011 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3014: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3016: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3051,12 +3053,12 @@ cross_compiling=$ac_cv_prog_cc_cross
 
 
 echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:3055: checking for uid_t in sys/types.h" >&5
+echo "configure:3057: checking for uid_t in sys/types.h" >&5
 if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3060 "configure"
+#line 3062 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 EOF
@@ -3085,7 +3087,7 @@ EOF
 fi
 
 echo $ac_n "checking type of array argument to getgroups""... $ac_c" 1>&6
-echo "configure:3089: checking type of array argument to getgroups" >&5
+echo "configure:3091: checking type of array argument to getgroups" >&5
 if eval "test \"`echo '$''{'ac_cv_type_getgroups'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3093,7 +3095,7 @@ else
   ac_cv_type_getgroups=cross
 else
   cat > conftest.$ac_ext <<EOF
-#line 3097 "configure"
+#line 3099 "configure"
 #include "confdefs.h"
 
 /* Thanks to Mike Rendell for this test.  */
@@ -3118,7 +3120,7 @@ main()
 }
 
 EOF
-if { (eval echo configure:3122: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3124: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
     ac_cv_type_getgroups=gid_t
 else
@@ -3132,7 +3134,7 @@ fi
 
 if test $ac_cv_type_getgroups = cross; then
         cat > conftest.$ac_ext <<EOF
-#line 3136 "configure"
+#line 3138 "configure"
 #include "confdefs.h"
 #include <unistd.h>
 EOF
@@ -3156,12 +3158,12 @@ EOF
 
 
 echo $ac_n "checking for mode_t""... $ac_c" 1>&6
-echo "configure:3160: checking for mode_t" >&5
+echo "configure:3162: checking for mode_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3165 "configure"
+#line 3167 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -3189,12 +3191,12 @@ EOF
 fi
 
 echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:3193: checking for off_t" >&5
+echo "configure:3195: checking for off_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3198 "configure"
+#line 3200 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -3222,12 +3224,12 @@ EOF
 fi
 
 echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:3226: checking for pid_t" >&5
+echo "configure:3228: checking for pid_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3231 "configure"
+#line 3233 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -3255,12 +3257,12 @@ EOF
 fi
 
 echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:3259: checking return type of signal handlers" >&5
+echo "configure:3261: checking return type of signal handlers" >&5
 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3264 "configure"
+#line 3266 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -3277,7 +3279,7 @@ int main() {
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:3281: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3283: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_type_signal=void
 else
@@ -3296,12 +3298,12 @@ EOF
 
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:3300: checking for size_t" >&5
+echo "configure:3302: checking for size_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3305 "configure"
+#line 3307 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -3329,12 +3331,12 @@ EOF
 fi
 
 echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:3333: checking for uid_t in sys/types.h" >&5
+echo "configure:3335: checking for uid_t in sys/types.h" >&5
 if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3338 "configure"
+#line 3340 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 EOF
@@ -3365,12 +3367,12 @@ fi
 
 
 echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6
-echo "configure:3369: checking whether stat file-mode macros are broken" >&5
+echo "configure:3371: checking whether stat file-mode macros are broken" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stat_broken'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3374 "configure"
+#line 3376 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -3421,12 +3423,12 @@ EOF
 fi
 
 echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:3425: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:3427: checking whether time.h and sys/time.h may both be included" >&5
 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3430 "configure"
+#line 3432 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/time.h>
@@ -3435,7 +3437,7 @@ int main() {
 struct tm *tp;
 ; return 0; }
 EOF
-if { (eval echo configure:3439: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3441: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_time=yes
 else
@@ -3456,12 +3458,12 @@ EOF
 fi
 
 echo $ac_n "checking for st_blksize in struct stat""... $ac_c" 1>&6
-echo "configure:3460: checking for st_blksize in struct stat" >&5
+echo "configure:3462: checking for st_blksize in struct stat" >&5
 if eval "test \"`echo '$''{'ac_cv_struct_st_blksize'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3465 "configure"
+#line 3467 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -3469,7 +3471,7 @@ int main() {
 struct stat s; s.st_blksize;
 ; return 0; }
 EOF
-if { (eval echo configure:3473: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3475: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_struct_st_blksize=yes
 else
@@ -3490,12 +3492,12 @@ EOF
 fi
  
 echo $ac_n "checking for st_blocks in struct stat""... $ac_c" 1>&6
-echo "configure:3494: checking for st_blocks in struct stat" >&5
+echo "configure:3496: checking for st_blocks in struct stat" >&5
 if eval "test \"`echo '$''{'ac_cv_struct_st_blocks'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3499 "configure"
+#line 3501 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -3503,7 +3505,7 @@ int main() {
 struct stat s; s.st_blocks;
 ; return 0; }
 EOF
-if { (eval echo configure:3507: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3509: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_struct_st_blocks=yes
 else
@@ -3526,12 +3528,12 @@ else
 fi
  
 echo $ac_n "checking for st_rdev in struct stat""... $ac_c" 1>&6
-echo "configure:3530: checking for st_rdev in struct stat" >&5
+echo "configure:3532: checking for st_rdev in struct stat" >&5
 if eval "test \"`echo '$''{'ac_cv_struct_st_rdev'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3535 "configure"
+#line 3537 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -3539,7 +3541,7 @@ int main() {
 struct stat s; s.st_rdev;
 ; return 0; }
 EOF
-if { (eval echo configure:3543: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3545: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_struct_st_rdev=yes
 else
@@ -3560,12 +3562,12 @@ EOF
 fi
  
 echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
-echo "configure:3564: checking whether struct tm is in sys/time.h or time.h" >&5
+echo "configure:3566: checking whether struct tm is in sys/time.h or time.h" >&5
 if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3569 "configure"
+#line 3571 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <time.h>
@@ -3573,7 +3575,7 @@ int main() {
 struct tm *tp; tp->tm_sec;
 ; return 0; }
 EOF
-if { (eval echo configure:3577: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3579: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_struct_tm=time.h
 else
@@ -3594,12 +3596,12 @@ EOF
 fi
 
 echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6
-echo "configure:3598: checking for tm_zone in struct tm" >&5
+echo "configure:3600: checking for tm_zone in struct tm" >&5
 if eval "test \"`echo '$''{'ac_cv_struct_tm_zone'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3603 "configure"
+#line 3605 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <$ac_cv_struct_tm>
@@ -3607,7 +3609,7 @@ int main() {
 struct tm tm; tm.tm_zone;
 ; return 0; }
 EOF
-if { (eval echo configure:3611: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3613: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_struct_tm_zone=yes
 else
@@ -3627,12 +3629,12 @@ EOF
 
 else
   echo $ac_n "checking for tzname""... $ac_c" 1>&6
-echo "configure:3631: checking for tzname" >&5
+echo "configure:3633: checking for tzname" >&5
 if eval "test \"`echo '$''{'ac_cv_var_tzname'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3636 "configure"
+#line 3638 "configure"
 #include "confdefs.h"
 #include <time.h>
 #ifndef tzname /* For SGI.  */
@@ -3642,7 +3644,7 @@ int main() {
 atoi(*tzname);
 ; return 0; }
 EOF
-if { (eval echo configure:3646: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3648: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   ac_cv_var_tzname=yes
 else
@@ -3666,12 +3668,12 @@ fi
 
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:3670: checking for working const" >&5
+echo "configure:3672: checking for working const" >&5
 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3675 "configure"
+#line 3677 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -3720,7 +3722,7 @@ ccp = (char const *const *) p;
 
 ; return 0; }
 EOF
-if { (eval echo configure:3724: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3726: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -3741,21 +3743,21 @@ EOF
 fi
 
 echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:3745: checking for inline" >&5
+echo "configure:3747: checking for inline" >&5
 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_cv_c_inline=no
 for ac_kw in inline __inline__ __inline; do
   cat > conftest.$ac_ext <<EOF
-#line 3752 "configure"
+#line 3754 "configure"
 #include "confdefs.h"
 
 int main() {
 } $ac_kw foo() {
 ; return 0; }
 EOF
-if { (eval echo configure:3759: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3761: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_inline=$ac_kw; break
 else
@@ -3781,14 +3783,14 @@ EOF
 esac
 
 echo $ac_n "checking whether char is unsigned""... $ac_c" 1>&6
-echo "configure:3785: checking whether char is unsigned" >&5
+echo "configure:3787: checking whether char is unsigned" >&5
 if eval "test \"`echo '$''{'ac_cv_c_char_unsigned'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test "$GCC" = yes; then
   # GCC predefines this symbol on systems where it applies.
 cat > conftest.$ac_ext <<EOF
-#line 3792 "configure"
+#line 3794 "configure"
 #include "confdefs.h"
 #ifdef __CHAR_UNSIGNED__
   yes
@@ -3810,7 +3812,7 @@ if test "$cross_compiling" = yes; then
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 3814 "configure"
+#line 3816 "configure"
 #include "confdefs.h"
 /* volatile prevents gcc2 from optimizing the test away on sparcs.  */
 #if !defined(__STDC__) || __STDC__ != 1
@@ -3820,7 +3822,7 @@ main() {
   volatile char c = 255; exit(c < 0);
 }
 EOF
-if { (eval echo configure:3824: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3826: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   ac_cv_c_char_unsigned=yes
 else
@@ -3844,7 +3846,7 @@ EOF
 fi
 
 echo $ac_n "checking for long double""... $ac_c" 1>&6
-echo "configure:3848: checking for long double" >&5
+echo "configure:3850: checking for long double" >&5
 if eval "test \"`echo '$''{'ac_cv_c_long_double'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3855,7 +3857,7 @@ if test "$cross_compiling" = yes; then
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 3859 "configure"
+#line 3861 "configure"
 #include "confdefs.h"
 int main() {
 /* The Stardent Vistra knows sizeof(long double), but does not support it.  */
@@ -3863,7 +3865,7 @@ long double foo = 0.0;
 /* On Ultrix 4.3 cc, long double is 4 and double is 8.  */
 exit(sizeof(long double) < sizeof(double)); }
 EOF
-if { (eval echo configure:3867: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3869: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   ac_cv_c_long_double=yes
 else
@@ -3888,14 +3890,14 @@ fi
 
 
 echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
-echo "configure:3892: checking whether byte ordering is bigendian" >&5
+echo "configure:3894: checking whether byte ordering is bigendian" >&5
 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_cv_c_bigendian=unknown
 # See if sys/param.h defines the BYTE_ORDER macro.
 cat > conftest.$ac_ext <<EOF
-#line 3899 "configure"
+#line 3901 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/param.h>
@@ -3906,11 +3908,11 @@ int main() {
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:3910: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3912: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   # It does; now see whether it defined to BIG_ENDIAN or not.
 cat > conftest.$ac_ext <<EOF
-#line 3914 "configure"
+#line 3916 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/param.h>
@@ -3921,7 +3923,7 @@ int main() {
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:3925: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3927: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_bigendian=yes
 else
@@ -3941,7 +3943,7 @@ if test "$cross_compiling" = yes; then
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 3945 "configure"
+#line 3947 "configure"
 #include "confdefs.h"
 main () {
   /* Are we little or big endian?  From Harbison&Steele.  */
@@ -3954,7 +3956,7 @@ main () {
   exit (u.c[sizeof (long) - 1] == 1);
 }
 EOF
-if { (eval echo configure:3958: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3960: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   ac_cv_c_bigendian=no
 else
@@ -3979,7 +3981,7 @@ fi
 
 
 echo $ac_n "checking size of int *""... $ac_c" 1>&6
-echo "configure:3983: checking size of int *" >&5
+echo "configure:3985: checking size of int *" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_int_p'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3987,7 +3989,7 @@ else
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 3991 "configure"
+#line 3993 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -3998,7 +4000,7 @@ main()
   exit(0);
 }
 EOF
-if { (eval echo configure:4002: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4004: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_int_p=`cat conftestval`
 else
@@ -4018,7 +4020,7 @@ EOF
 
 
 echo $ac_n "checking size of int""... $ac_c" 1>&6
-echo "configure:4022: checking size of int" >&5
+echo "configure:4024: checking size of int" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4026,7 +4028,7 @@ else
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 4030 "configure"
+#line 4032 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -4037,7 +4039,7 @@ main()
   exit(0);
 }
 EOF
-if { (eval echo configure:4041: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4043: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_int=`cat conftestval`
 else
@@ -4057,7 +4059,7 @@ EOF
 
 
 echo $ac_n "checking size of long""... $ac_c" 1>&6
-echo "configure:4061: checking size of long" >&5
+echo "configure:4063: checking size of long" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4065,7 +4067,7 @@ else
     { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 4069 "configure"
+#line 4071 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -4076,7 +4078,7 @@ main()
   exit(0);
 }
 EOF
-if { (eval echo configure:4080: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4082: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_long=`cat conftestval`
 else
@@ -4100,7 +4102,7 @@ EOF
 
 
 echo $ac_n "checking for long file names""... $ac_c" 1>&6
-echo "configure:4104: checking for long file names" >&5
+echo "configure:4106: checking for long file names" >&5
 if eval "test \"`echo '$''{'ac_cv_sys_long_file_names'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4151,7 +4153,7 @@ 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 $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4155: checking for $ac_word" >&5
+echo "configure:4157: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4184,7 +4186,7 @@ test -n "$YACC" || YACC="yacc"
 # Extract the first word of "flex", so it can be a program name with args.
 set dummy flex; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4188: checking for $ac_word" >&5
+echo "configure:4190: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4217,7 +4219,7 @@ then
   *) ac_lib=l ;;
   esac
   echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6
-echo "configure:4221: checking for yywrap in -l$ac_lib" >&5
+echo "configure:4223: checking for yywrap in -l$ac_lib" >&5
 ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4225,7 +4227,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-l$ac_lib  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4229 "configure"
+#line 4231 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4236,7 +4238,7 @@ int main() {
 yywrap()
 ; return 0; }
 EOF
-if { (eval echo configure:4240: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4242: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4259,7 +4261,7 @@ fi
 fi
 
 echo $ac_n "checking lex output file root""... $ac_c" 1>&6
-echo "configure:4263: checking lex output file root" >&5
+echo "configure:4265: checking lex output file root" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_lex_root'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4280,7 +4282,7 @@ echo "$ac_t""$ac_cv_prog_lex_root" 1>&6
 LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root
 
 echo $ac_n "checking whether yytext is a pointer""... $ac_c" 1>&6
-echo "configure:4284: checking whether yytext is a pointer" >&5
+echo "configure:4286: checking whether yytext is a pointer" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_lex_yytext_pointer'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4292,14 +4294,14 @@ echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c
 ac_save_LIBS="$LIBS"
 LIBS="$LIBS $LEXLIB"
 cat > conftest.$ac_ext <<EOF
-#line 4296 "configure"
+#line 4298 "configure"
 #include "confdefs.h"
 `cat $LEX_OUTPUT_ROOT.c`
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:4303: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4305: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   ac_cv_prog_lex_yytext_pointer=yes
 else
@@ -4333,7 +4335,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
 fi
 
 echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:4337: checking host system type" >&5
+echo "configure:4339: checking host system type" >&5
 
 host_alias=$host
 case "$host_alias" in
@@ -4596,7 +4598,7 @@ DEFAULT_wxUSE_WCSRTOMBS=0
 
 
 echo $ac_n "checking "for gtk"""... $ac_c" 1>&6
-echo "configure:4600: checking "for gtk"" >&5
+echo "configure:4602: checking "for gtk"" >&5
 # Check whether --with-gtk or --without-gtk was given.
 if test "${with_gtk+set}" = set; then
   withval="$with_gtk"
@@ -4626,7 +4628,7 @@ fi
 
 
 echo $ac_n "checking "for qt"""... $ac_c" 1>&6
-echo "configure:4630: checking "for qt"" >&5
+echo "configure:4632: checking "for qt"" >&5
 # Check whether --with-qt or --without-qt was given.
 if test "${with_qt+set}" = set; then
   withval="$with_qt"
@@ -4656,7 +4658,7 @@ fi
 
 
 echo $ac_n "checking "for motif"""... $ac_c" 1>&6
-echo "configure:4660: checking "for motif"" >&5
+echo "configure:4662: checking "for motif"" >&5
 # Check whether --with-motif or --without-motif was given.
 if test "${with_motif+set}" = set; then
   withval="$with_motif"
@@ -4687,7 +4689,7 @@ fi
 
 
 echo $ac_n "checking "for shared"""... $ac_c" 1>&6
-echo "configure:4691: checking "for shared"" >&5
+echo "configure:4693: checking "for shared"" >&5
 # Check whether --with-shared or --without-shared was given.
 if test "${with_shared+set}" = set; then
   withval="$with_shared"
@@ -4717,7 +4719,7 @@ fi
 
 
 echo $ac_n "checking "for optimise"""... $ac_c" 1>&6
-echo "configure:4721: checking "for optimise"" >&5
+echo "configure:4723: checking "for optimise"" >&5
 # Check whether --with-optimise or --without-optimise was given.
 if test "${with_optimise+set}" = set; then
   withval="$with_optimise"
@@ -4747,7 +4749,7 @@ fi
 
 
 echo $ac_n "checking "for debug_flag"""... $ac_c" 1>&6
-echo "configure:4751: checking "for debug_flag"" >&5
+echo "configure:4753: checking "for debug_flag"" >&5
 # Check whether --with-debug_flag or --without-debug_flag was given.
 if test "${with_debug_flag+set}" = set; then
   withval="$with_debug_flag"
@@ -4777,7 +4779,7 @@ fi
 
 
 echo $ac_n "checking "for debug_info"""... $ac_c" 1>&6
-echo "configure:4781: checking "for debug_info"" >&5
+echo "configure:4783: checking "for debug_info"" >&5
 # Check whether --with-debug_info or --without-debug_info was given.
 if test "${with_debug_info+set}" = set; then
   withval="$with_debug_info"
@@ -4807,7 +4809,7 @@ fi
 
 
 echo $ac_n "checking "for debug_gdb"""... $ac_c" 1>&6
-echo "configure:4811: checking "for debug_gdb"" >&5
+echo "configure:4813: checking "for debug_gdb"" >&5
 # Check whether --with-debug_gdb or --without-debug_gdb was given.
 if test "${with_debug_gdb+set}" = set; then
   withval="$with_debug_gdb"
@@ -4837,7 +4839,7 @@ fi
 
 
 echo $ac_n "checking "for mem_tracing"""... $ac_c" 1>&6
-echo "configure:4841: checking "for mem_tracing"" >&5
+echo "configure:4843: checking "for mem_tracing"" >&5
 # Check whether --with-mem_tracing or --without-mem_tracing was given.
 if test "${with_mem_tracing+set}" = set; then
   withval="$with_mem_tracing"
@@ -4867,7 +4869,7 @@ fi
 
 
 echo $ac_n "checking "for dmalloc"""... $ac_c" 1>&6
-echo "configure:4871: checking "for dmalloc"" >&5
+echo "configure:4873: checking "for dmalloc"" >&5
 # Check whether --with-dmalloc or --without-dmalloc was given.
 if test "${with_dmalloc+set}" = set; then
   withval="$with_dmalloc"
@@ -4897,7 +4899,7 @@ fi
 
 
 echo $ac_n "checking "for profile"""... $ac_c" 1>&6
-echo "configure:4901: checking "for profile"" >&5
+echo "configure:4903: checking "for profile"" >&5
 # Check whether --with-profile or --without-profile was given.
 if test "${with_profile+set}" = set; then
   withval="$with_profile"
@@ -4927,7 +4929,7 @@ fi
 
 
 echo $ac_n "checking "for apple_ieee"""... $ac_c" 1>&6
-echo "configure:4931: checking "for apple_ieee"" >&5
+echo "configure:4933: checking "for apple_ieee"" >&5
 # Check whether --with-apple_ieee or --without-apple_ieee was given.
 if test "${with_apple_ieee+set}" = set; then
   withval="$with_apple_ieee"
@@ -4958,7 +4960,7 @@ fi
 
 
 echo $ac_n "checking "for zlib"""... $ac_c" 1>&6
-echo "configure:4962: checking "for zlib"" >&5
+echo "configure:4964: checking "for zlib"" >&5
 # Check whether --with-zlib or --without-zlib was given.
 if test "${with_zlib+set}" = set; then
   withval="$with_zlib"
@@ -4988,7 +4990,7 @@ fi
 
 
 echo $ac_n "checking "for libpng"""... $ac_c" 1>&6
-echo "configure:4992: checking "for libpng"" >&5
+echo "configure:4994: checking "for libpng"" >&5
 # Check whether --with-libpng or --without-libpng was given.
 if test "${with_libpng+set}" = set; then
   withval="$with_libpng"
@@ -5018,7 +5020,7 @@ fi
 
 
 echo $ac_n "checking "for odbc"""... $ac_c" 1>&6
-echo "configure:5022: checking "for odbc"" >&5
+echo "configure:5024: checking "for odbc"" >&5
 # Check whether --with-odbc or --without-odbc was given.
 if test "${with_odbc+set}" = set; then
   withval="$with_odbc"
@@ -5048,7 +5050,7 @@ fi
 
 
 echo $ac_n "checking "for opengl"""... $ac_c" 1>&6
-echo "configure:5052: checking "for opengl"" >&5
+echo "configure:5054: checking "for opengl"" >&5
 # Check whether --with-opengl or --without-opengl was given.
 if test "${with_opengl+set}" = set; then
   withval="$with_opengl"
@@ -5079,7 +5081,7 @@ fi
 
 
 echo $ac_n "checking "for gauge"""... $ac_c" 1>&6
-echo "configure:5083: checking "for gauge"" >&5
+echo "configure:5085: checking "for gauge"" >&5
 # Check whether --with-gauge or --without-gauge was given.
 if test "${with_gauge+set}" = set; then
   withval="$with_gauge"
@@ -5109,7 +5111,7 @@ fi
 
 
 echo $ac_n "checking "for combobox"""... $ac_c" 1>&6
-echo "configure:5113: checking "for combobox"" >&5
+echo "configure:5115: checking "for combobox"" >&5
 # Check whether --with-combobox or --without-combobox was given.
 if test "${with_combobox+set}" = set; then
   withval="$with_combobox"
@@ -5139,7 +5141,7 @@ fi
 
 
 echo $ac_n "checking "for scrollbar"""... $ac_c" 1>&6
-echo "configure:5143: checking "for scrollbar"" >&5
+echo "configure:5145: checking "for scrollbar"" >&5
 # Check whether --with-scrollbar or --without-scrollbar was given.
 if test "${with_scrollbar+set}" = set; then
   withval="$with_scrollbar"
@@ -5169,7 +5171,7 @@ fi
 
 
 echo $ac_n "checking "for listctrl"""... $ac_c" 1>&6
-echo "configure:5173: checking "for listctrl"" >&5
+echo "configure:5175: checking "for listctrl"" >&5
 # Check whether --with-listctrl or --without-listctrl was given.
 if test "${with_listctrl+set}" = set; then
   withval="$with_listctrl"
@@ -5199,7 +5201,7 @@ fi
 
 
 echo $ac_n "checking "for treectrl"""... $ac_c" 1>&6
-echo "configure:5203: checking "for treectrl"" >&5
+echo "configure:5205: checking "for treectrl"" >&5
 # Check whether --with-treectrl or --without-treectrl was given.
 if test "${with_treectrl+set}" = set; then
   withval="$with_treectrl"
@@ -5229,7 +5231,7 @@ fi
 
 
 echo $ac_n "checking "for grid"""... $ac_c" 1>&6
-echo "configure:5233: checking "for grid"" >&5
+echo "configure:5235: checking "for grid"" >&5
 # Check whether --with-grid or --without-grid was given.
 if test "${with_grid+set}" = set; then
   withval="$with_grid"
@@ -5259,7 +5261,7 @@ fi
 
 
 echo $ac_n "checking "for tab_dialog"""... $ac_c" 1>&6
-echo "configure:5263: checking "for tab_dialog"" >&5
+echo "configure:5265: checking "for tab_dialog"" >&5
 # Check whether --with-tab_dialog or --without-tab_dialog was given.
 if test "${with_tab_dialog+set}" = set; then
   withval="$with_tab_dialog"
@@ -5289,7 +5291,7 @@ fi
 
 
 echo $ac_n "checking "for notebook"""... $ac_c" 1>&6
-echo "configure:5293: checking "for notebook"" >&5
+echo "configure:5295: checking "for notebook"" >&5
 # Check whether --with-notebook or --without-notebook was given.
 if test "${with_notebook+set}" = set; then
   withval="$with_notebook"
@@ -5320,7 +5322,7 @@ fi
 
 
 echo $ac_n "checking "for timedate"""... $ac_c" 1>&6
-echo "configure:5324: checking "for timedate"" >&5
+echo "configure:5326: checking "for timedate"" >&5
 # Check whether --with-timedate or --without-timedate was given.
 if test "${with_timedate+set}" = set; then
   withval="$with_timedate"
@@ -5350,7 +5352,7 @@ fi
 
 
 echo $ac_n "checking "for fraction"""... $ac_c" 1>&6
-echo "configure:5354: checking "for fraction"" >&5
+echo "configure:5356: checking "for fraction"" >&5
 # Check whether --with-fraction or --without-fraction was given.
 if test "${with_fraction+set}" = set; then
   withval="$with_fraction"
@@ -5380,7 +5382,7 @@ fi
 
 
 echo $ac_n "checking "for log"""... $ac_c" 1>&6
-echo "configure:5384: checking "for log"" >&5
+echo "configure:5386: checking "for log"" >&5
 # Check whether --with-log or --without-log was given.
 if test "${with_log+set}" = set; then
   withval="$with_log"
@@ -5410,7 +5412,7 @@ fi
 
 
 echo $ac_n "checking "for intl"""... $ac_c" 1>&6
-echo "configure:5414: checking "for intl"" >&5
+echo "configure:5416: checking "for intl"" >&5
 # Check whether --with-intl or --without-intl was given.
 if test "${with_intl+set}" = set; then
   withval="$with_intl"
@@ -5440,7 +5442,7 @@ fi
 
 
 echo $ac_n "checking "for config"""... $ac_c" 1>&6
-echo "configure:5444: checking "for config"" >&5
+echo "configure:5446: checking "for config"" >&5
 # Check whether --with-config or --without-config was given.
 if test "${with_config+set}" = set; then
   withval="$with_config"
@@ -5470,7 +5472,7 @@ fi
 
 
 echo $ac_n "checking "for streams"""... $ac_c" 1>&6
-echo "configure:5474: checking "for streams"" >&5
+echo "configure:5476: checking "for streams"" >&5
 # Check whether --with-streams or --without-streams was given.
 if test "${with_streams+set}" = set; then
   withval="$with_streams"
@@ -5500,7 +5502,7 @@ fi
 
 
 echo $ac_n "checking "for serial"""... $ac_c" 1>&6
-echo "configure:5504: checking "for serial"" >&5
+echo "configure:5506: checking "for serial"" >&5
 # Check whether --with-serial or --without-serial was given.
 if test "${with_serial+set}" = set; then
   withval="$with_serial"
@@ -5530,7 +5532,7 @@ fi
 
 
 echo $ac_n "checking "for file"""... $ac_c" 1>&6
-echo "configure:5534: checking "for file"" >&5
+echo "configure:5536: checking "for file"" >&5
 # Check whether --with-file or --without-file was given.
 if test "${with_file+set}" = set; then
   withval="$with_file"
@@ -5560,7 +5562,7 @@ fi
 
 
 echo $ac_n "checking "for textfile"""... $ac_c" 1>&6
-echo "configure:5564: checking "for textfile"" >&5
+echo "configure:5566: checking "for textfile"" >&5
 # Check whether --with-textfile or --without-textfile was given.
 if test "${with_textfile+set}" = set; then
   withval="$with_textfile"
@@ -5591,7 +5593,7 @@ fi
 
 
 echo $ac_n "checking "for afmfonts"""... $ac_c" 1>&6
-echo "configure:5595: checking "for afmfonts"" >&5
+echo "configure:5597: checking "for afmfonts"" >&5
 # Check whether --with-afmfonts or --without-afmfonts was given.
 if test "${with_afmfonts+set}" = set; then
   withval="$with_afmfonts"
@@ -5621,7 +5623,7 @@ fi
 
 
 echo $ac_n "checking "for normalized"""... $ac_c" 1>&6
-echo "configure:5625: checking "for normalized"" >&5
+echo "configure:5627: checking "for normalized"" >&5
 # Check whether --with-normalized or --without-normalized was given.
 if test "${with_normalized+set}" = set; then
   withval="$with_normalized"
@@ -5651,7 +5653,7 @@ fi
 
 
 echo $ac_n "checking "for postscript"""... $ac_c" 1>&6
-echo "configure:5655: checking "for postscript"" >&5
+echo "configure:5657: checking "for postscript"" >&5
 # Check whether --with-postscript or --without-postscript was given.
 if test "${with_postscript+set}" = set; then
   withval="$with_postscript"
@@ -5682,7 +5684,7 @@ fi
 
 
 echo $ac_n "checking "for unicode"""... $ac_c" 1>&6
-echo "configure:5686: checking "for unicode"" >&5
+echo "configure:5688: checking "for unicode"" >&5
 # Check whether --with-unicode or --without-unicode was given.
 if test "${with_unicode+set}" = set; then
   withval="$with_unicode"
@@ -5712,7 +5714,7 @@ fi
 
 
 echo $ac_n "checking "for wcsrtombs"""... $ac_c" 1>&6
-echo "configure:5716: checking "for wcsrtombs"" >&5
+echo "configure:5718: checking "for wcsrtombs"" >&5
 # Check whether --with-wcsrtombs or --without-wcsrtombs was given.
 if test "${with_wcsrtombs+set}" = set; then
   withval="$with_wcsrtombs"
@@ -5743,7 +5745,7 @@ fi
 
 
 echo $ac_n "checking "for wxresources"""... $ac_c" 1>&6
-echo "configure:5747: checking "for wxresources"" >&5
+echo "configure:5749: checking "for wxresources"" >&5
 # Check whether --with-wxresources or --without-wxresources was given.
 if test "${with_wxresources+set}" = set; then
   withval="$with_wxresources"
@@ -5773,7 +5775,7 @@ fi
 
 
 echo $ac_n "checking "for prologio"""... $ac_c" 1>&6
-echo "configure:5777: checking "for prologio"" >&5
+echo "configure:5779: checking "for prologio"" >&5
 # Check whether --with-prologio or --without-prologio was given.
 if test "${with_prologio+set}" = set; then
   withval="$with_prologio"
@@ -5803,7 +5805,7 @@ fi
 
 
 echo $ac_n "checking "for RPC"""... $ac_c" 1>&6
-echo "configure:5807: checking "for RPC"" >&5
+echo "configure:5809: checking "for RPC"" >&5
 # Check whether --with-rpc or --without-rpc was given.
 if test "${with_rpc+set}" = set; then
   withval="$with_rpc"
@@ -5834,7 +5836,7 @@ fi
 
 
 echo $ac_n "checking "for IPC"""... $ac_c" 1>&6
-echo "configure:5838: checking "for IPC"" >&5
+echo "configure:5840: checking "for IPC"" >&5
 # Check whether --with-ipc or --without-ipc was given.
 if test "${with_ipc+set}" = set; then
   withval="$with_ipc"
@@ -5864,7 +5866,7 @@ fi
 
 
 echo $ac_n "checking "for resources"""... $ac_c" 1>&6
-echo "configure:5868: checking "for resources"" >&5
+echo "configure:5870: checking "for resources"" >&5
 # Check whether --with-resources or --without-resources was given.
 if test "${with_resources+set}" = set; then
   withval="$with_resources"
@@ -5894,7 +5896,7 @@ fi
 
 
 echo $ac_n "checking "for clipboard"""... $ac_c" 1>&6
-echo "configure:5898: checking "for clipboard"" >&5
+echo "configure:5900: checking "for clipboard"" >&5
 # Check whether --with-clipboard or --without-clipboard was given.
 if test "${with_clipboard+set}" = set; then
   withval="$with_clipboard"
@@ -5924,7 +5926,7 @@ fi
 
 
 echo $ac_n "checking "for dnd"""... $ac_c" 1>&6
-echo "configure:5928: checking "for dnd"" >&5
+echo "configure:5930: checking "for dnd"" >&5
 # Check whether --with-dnd or --without-dnd was given.
 if test "${with_dnd+set}" = set; then
   withval="$with_dnd"
@@ -5954,7 +5956,7 @@ fi
 
 
 echo $ac_n "checking "for constrains"""... $ac_c" 1>&6
-echo "configure:5958: checking "for constrains"" >&5
+echo "configure:5960: checking "for constrains"" >&5
 # Check whether --with-constraints or --without-constraints was given.
 if test "${with_constraints+set}" = set; then
   withval="$with_constraints"
@@ -5985,7 +5987,7 @@ fi
 
 
 echo $ac_n "checking "for mdi"""... $ac_c" 1>&6
-echo "configure:5989: checking "for mdi"" >&5
+echo "configure:5991: checking "for mdi"" >&5
 # Check whether --with-mdi or --without-mdi was given.
 if test "${with_mdi+set}" = set; then
   withval="$with_mdi"
@@ -6015,7 +6017,7 @@ fi
 
 
 echo $ac_n "checking "for docview"""... $ac_c" 1>&6
-echo "configure:6019: checking "for docview"" >&5
+echo "configure:6021: checking "for docview"" >&5
 # Check whether --with-docview or --without-docview was given.
 if test "${with_docview+set}" = set; then
   withval="$with_docview"
@@ -6045,7 +6047,7 @@ fi
 
 
 echo $ac_n "checking "for printarch"""... $ac_c" 1>&6
-echo "configure:6049: checking "for printarch"" >&5
+echo "configure:6051: checking "for printarch"" >&5
 # Check whether --with-printarch or --without-printarch was given.
 if test "${with_printarch+set}" = set; then
   withval="$with_printarch"
@@ -6075,7 +6077,7 @@ fi
 
 
 echo $ac_n "checking "for help"""... $ac_c" 1>&6
-echo "configure:6079: checking "for help"" >&5
+echo "configure:6081: checking "for help"" >&5
 # Check whether --with-help or --without-help was given.
 if test "${with_help+set}" = set; then
   withval="$with_help"
@@ -6157,7 +6159,7 @@ fi
   # Extract the first word of "gtk-config", so it can be a program name with args.
 set dummy gtk-config; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:6161: checking for $ac_word" >&5
+echo "configure:6163: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_GTK_CONFIG'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6188,7 +6190,7 @@ fi
 
   min_gtk_version=1.0.4
   echo $ac_n "checking for GTK - version >= $min_gtk_version""... $ac_c" 1>&6
-echo "configure:6192: checking for GTK - version >= $min_gtk_version" >&5
+echo "configure:6194: checking for GTK - version >= $min_gtk_version" >&5
   no_gtk=""
   if test "$GTK_CONFIG" != "no" ; then
     GTK_CFLAGS=`$GTK_CONFIG --cflags`
@@ -6201,7 +6203,7 @@ echo "configure:6192: checking for GTK - version >= $min_gtk_version" >&5
   echo $ac_n "cross compiling; assumed OK... $ac_c"
 else
   cat > conftest.$ac_ext <<EOF
-#line 6205 "configure"
+#line 6207 "configure"
 #include "confdefs.h"
 
 #include <gtk/gtk.h>
@@ -6225,7 +6227,7 @@ main ()
 }
 
 EOF
-if { (eval echo configure:6229: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6231: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -6265,7 +6267,7 @@ fi
 
 if test "$wxUSE_QT" = 1; then
    echo $ac_n "checking for Qt includes""... $ac_c" 1>&6
-echo "configure:6269: checking for Qt includes" >&5
+echo "configure:6271: checking for Qt includes" >&5
    
 ac_find_includes=
 for ac_dir in $SEARCH_INCLUDE;
@@ -6279,7 +6281,7 @@ for ac_dir in $SEARCH_INCLUDE;
    if test "$ac_find_includes" != "" ; then
      echo "$ac_t""found $ac_find_includes" 1>&6
      echo $ac_n "checking for Qt library""... $ac_c" 1>&6
-echo "configure:6283: checking for Qt library" >&5
+echo "configure:6285: checking for Qt library" >&5
      
 ac_find_libraries=
 for ac_dir in $SEARCH_LIB;
@@ -6330,7 +6332,7 @@ fi
 
 if test "$wxUSE_MOTIF" = 1; then
    echo $ac_n "checking for Motif/Lesstif includes""... $ac_c" 1>&6
-echo "configure:6334: checking for Motif/Lesstif includes" >&5
+echo "configure:6336: checking for Motif/Lesstif includes" >&5
    
 ac_find_includes=
 for ac_dir in $SEARCH_INCLUDE;
@@ -6344,7 +6346,7 @@ for ac_dir in $SEARCH_INCLUDE;
    if test "$ac_find_includes" != "" ; then
      echo "$ac_t""found $ac_find_includes" 1>&6
      echo $ac_n "checking for Motif/Lesstif library""... $ac_c" 1>&6
-echo "configure:6348: checking for Motif/Lesstif library" >&5
+echo "configure:6350: checking for Motif/Lesstif library" >&5
      
 ac_find_libraries=
 for ac_dir in $SEARCH_LIB;
@@ -6381,7 +6383,7 @@ for ac_dir in $SEARCH_LIB;
        CHECK_INCLUDE="$CHECK_INCLUDE $ac_path_to_include"
        echo "$ac_t""found at $ac_find_libraries" 1>&6
        echo $ac_n "checking for Xt library""... $ac_c" 1>&6
-echo "configure:6385: checking for Xt library" >&5
+echo "configure:6387: checking for Xt library" >&5
        
 ac_find_libraries=
 for ac_dir in $SEARCH_LIB;
@@ -6407,7 +6409,7 @@ for ac_dir in $SEARCH_LIB;
          CHECK_LINK="$CHECK_LIB $ac_path_to_link"
          echo "$ac_t""found at $ac_find_libraries" 1>&6
          echo $ac_n "checking for Xpm library""... $ac_c" 1>&6
-echo "configure:6411: checking for Xpm library" >&5
+echo "configure:6413: checking for Xpm library" >&5
          
 ac_find_libraries=
 for ac_dir in $SEARCH_LIB;
@@ -6857,7 +6859,7 @@ fi
 
 
 echo $ac_n "checking for main in -ldl""... $ac_c" 1>&6
-echo "configure:6861: checking for main in -ldl" >&5
+echo "configure:6863: checking for main in -ldl" >&5
 ac_lib_var=`echo dl'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -6865,14 +6867,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6869 "configure"
+#line 6871 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:6876: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6878: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6902,7 +6904,7 @@ UNIX_THREAD="gtk/threadno.cpp"
 
 
 echo $ac_n "checking "for threads"""... $ac_c" 1>&6
-echo "configure:6906: checking "for threads"" >&5
+echo "configure:6908: checking "for threads"" >&5
 # Check whether --with-threads or --without-threads was given.
 if test "${with_threads+set}" = set; then
   withval="$with_threads"
@@ -6936,7 +6938,7 @@ if test "$wxUSE_THREADS" = "1"; then
    solaris*)
 
       echo $ac_n "checking for thr_create in -lthread""... $ac_c" 1>&6
-echo "configure:6940: checking for thr_create in -lthread" >&5
+echo "configure:6942: checking for thr_create in -lthread" >&5
 ac_lib_var=`echo thread'_'thr_create | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -6944,7 +6946,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lthread  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6948 "configure"
+#line 6950 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -6955,7 +6957,7 @@ int main() {
 thr_create()
 ; return 0; }
 EOF
-if { (eval echo configure:6959: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6961: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6986,7 +6988,7 @@ fi
 
      
      echo $ac_n "checking for pthread_create in -lpthread-0.7""... $ac_c" 1>&6
-echo "configure:6990: checking for pthread_create in -lpthread-0.7" >&5
+echo "configure:6992: checking for pthread_create in -lpthread-0.7" >&5
 ac_lib_var=`echo pthread-0.7'_'pthread_create | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -6994,7 +6996,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lpthread-0.7  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6998 "configure"
+#line 7000 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -7005,7 +7007,7 @@ int main() {
 pthread_create()
 ; return 0; }
 EOF
-if { (eval echo configure:7009: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7011: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -7029,17 +7031,17 @@ else
 
        ac_safe=`echo "sys/prctl.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for sys/prctl.h""... $ac_c" 1>&6
-echo "configure:7033: checking for sys/prctl.h" >&5
+echo "configure:7035: checking for sys/prctl.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 7038 "configure"
+#line 7040 "configure"
 #include "confdefs.h"
 #include <sys/prctl.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:7043: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7045: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -7065,7 +7067,7 @@ fi
 
           
      echo $ac_n "checking for pthread_setcanceltype in -lpthread""... $ac_c" 1>&6
-echo "configure:7069: checking for pthread_setcanceltype in -lpthread" >&5
+echo "configure:7071: checking for pthread_setcanceltype in -lpthread" >&5
 ac_lib_var=`echo pthread'_'pthread_setcanceltype | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -7073,7 +7075,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lpthread  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 7077 "configure"
+#line 7079 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -7084,7 +7086,7 @@ int main() {
 pthread_setcanceltype()
 ; return 0; }
 EOF
-if { (eval echo configure:7088: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7090: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -7113,7 +7115,7 @@ fi
 
     
     echo $ac_n "checking for printf in -lposix4""... $ac_c" 1>&6
-echo "configure:7117: checking for printf in -lposix4" >&5
+echo "configure:7119: checking for printf in -lposix4" >&5
 ac_lib_var=`echo posix4'_'printf | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -7121,7 +7123,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lposix4  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 7125 "configure"
+#line 7127 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -7132,7 +7134,7 @@ int main() {
 printf()
 ; return 0; }
 EOF
-if { (eval echo configure:7136: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7138: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -7181,7 +7183,7 @@ OPENGL_LINK=
 
 if test "$wxUSE_OPENGL" = 1; then
     echo $ac_n "checking for OpenGL includes""... $ac_c" 1>&6
-echo "configure:7185: checking for OpenGL includes" >&5
+echo "configure:7187: checking for OpenGL includes" >&5
   
 ac_find_includes=
 for ac_dir in $SEARCH_INCLUDE;
@@ -7196,7 +7198,7 @@ for ac_dir in $SEARCH_INCLUDE;
     OPENGL_INCLUDE="-I$ac_find_includes"
     echo "$ac_t""found $ac_find_includes" 1>&6
         echo $ac_n "checking for OpenGL library""... $ac_c" 1>&6
-echo "configure:7200: checking for OpenGL library" >&5
+echo "configure:7202: checking for OpenGL library" >&5
     
 ac_find_libraries=
 for ac_dir in $SEARCH_LIB;
index 25edff65da6344daf2dece61c8bd8e4eb4e1c895..190144804dacf6e7535a22be731081fe37f07c79 100644 (file)
 #include <windows.h>
 #endif
 
+
+#ifdef __WXGTK__
+
+extern "C" {
+#include <../iodbc/isql.h>
+#include <../iodbc/isqlext.h>
+#include <../iodbc/odbc_funcs.h>
+#include <../iodbc/odbc_types.h>
+
+typedef float   SFLOAT;
+typedef double  SDOUBLE;
+#define ULONG UDWORD
+
+}
+
+#else
+
 #define ODBCVER 0x0250
 #include <sql.h>
 #include <sqlext.h>
 
+#endif
+
 enum           enumDummy               {enumDum1};
 
 #define SQL_C_BOOLEAN (sizeof(int) == 2 ? SQL_C_USHORT : SQL_C_ULONG)
 #define SQL_C_ENUM (sizeof(enumDummy) == 2 ? SQL_C_USHORT : SQL_C_ULONG)    //glt 2-21-97
 
 // Database Globals
-const DB_TYPE_NAME_LEN                                         = 40;
-const DB_MAX_STATEMENT_LEN                                     = 2048;
-const DB_MAX_WHERE_CLAUSE_LEN                          = 1024;
-const DB_MAX_ERROR_MSG_LEN                                     = 512;
-const DB_MAX_ERROR_HISTORY                                     = 5;
-const DB_MAX_TABLE_NAME_LEN                            = 128;
-const DB_MAX_COLUMN_NAME_LEN                           = 128;
-
-const DB_DATA_TYPE_VARCHAR                                     = 1;
-const DB_DATA_TYPE_INTEGER                                     = 2;
-const DB_DATA_TYPE_FLOAT                                       = 3;
-const  DB_DATA_TYPE_DATE                                               = 4;
-
-const DB_SELECT_KEYFIELDS                                      = 1;
-const DB_SELECT_WHERE                                          = 2;
-const DB_SELECT_MATCHING                                       = 3;
-const DB_SELECT_STATEMENT                                      = 4;
-
-const DB_UPD_KEYFIELDS                                         = 1;
-const DB_UPD_WHERE                                                     = 2;
-
-const DB_DEL_KEYFIELDS                                         = 1;
-const DB_DEL_WHERE                                                     = 2;
-const DB_DEL_MATCHING                                          = 3;
-
-const DB_WHERE_KEYFIELDS                                       = 1;
-const DB_WHERE_MATCHING                                                = 2;
-
-const DB_CURSOR0                                                               = 0;
-const DB_CURSOR1                                                               = 1;
-const DB_CURSOR2                                                               = 2;
-//const DB_CURSOR3                                                     = 3;
-//const DB_CURSOR4                                                     = 4;
-//const DB_CURSOR5                                                     = 5;
-
-const DB_GRANT_SELECT                                          = 1;
-const DB_GRANT_INSERT                                          = 2;
-const DB_GRANT_UPDATE                                          = 4;
-const DB_GRANT_DELETE                                          = 8;
-const DB_GRANT_ALL                                                     = DB_GRANT_SELECT | DB_GRANT_INSERT | DB_GRANT_UPDATE | DB_GRANT_DELETE;
+const int DB_TYPE_NAME_LEN                                             = 40;
+const int DB_MAX_STATEMENT_LEN                                 = 2048;
+const int DB_MAX_WHERE_CLAUSE_LEN                              = 1024;
+const int DB_MAX_ERROR_MSG_LEN                                 = 512;
+const int DB_MAX_ERROR_HISTORY                                 = 5;
+const int DB_MAX_TABLE_NAME_LEN                                = 128;
+const int DB_MAX_COLUMN_NAME_LEN                               = 128;
+
+const int DB_DATA_TYPE_VARCHAR                                 = 1;
+const int DB_DATA_TYPE_INTEGER                                 = 2;
+const int DB_DATA_TYPE_FLOAT                                   = 3;
+const int DB_DATA_TYPE_DATE                                            = 4;
+
+const int DB_SELECT_KEYFIELDS                                  = 1;
+const int DB_SELECT_WHERE                                              = 2;
+const int DB_SELECT_MATCHING                                   = 3;
+const int DB_SELECT_STATEMENT                                  = 4;
+
+const int DB_UPD_KEYFIELDS                                             = 1;
+const int DB_UPD_WHERE                                                 = 2;
+
+const int DB_DEL_KEYFIELDS                                             = 1;
+const int DB_DEL_WHERE                                                 = 2;
+const int DB_DEL_MATCHING                                              = 3;
+
+const int DB_WHERE_KEYFIELDS                                   = 1;
+const int DB_WHERE_MATCHING                                            = 2;
+
+const int DB_CURSOR0                                                           = 0;
+const int DB_CURSOR1                                                           = 1;
+const int DB_CURSOR2                                                           = 2;
+//const int DB_CURSOR3                                                 = 3;
+//const int DB_CURSOR4                                                 = 4;
+//const int DB_CURSOR5                                                 = 5;
+
+const int DB_GRANT_SELECT                                              = 1;
+const int DB_GRANT_INSERT                                              = 2;
+const int DB_GRANT_UPDATE                                              = 4;
+const int DB_GRANT_DELETE                                              = 8;
+const int DB_GRANT_ALL                                                 = DB_GRANT_SELECT | DB_GRANT_INSERT | DB_GRANT_UPDATE | DB_GRANT_DELETE;
 
 // ODBC Error codes (derived from ODBC SqlState codes)
 enum ODBC_ERRORS
index 0fa4fef0b9f598521ec20d775c693f7846433672..fe52615bce1448dccd8842cb5c55d08c79fb0404 100644 (file)
@@ -32,7 +32,7 @@
 
 #include "wx/db.h"
 
-const ROWID_LEN = 24;  // 18 is the max, 24 is in case it gets larger
+const int ROWID_LEN = 24;  // 18 is the max, 24 is in case it gets larger
 
 // The following class is used to define a column of a table.
 // The wxTable constructor will dynamically allocate as many of
@@ -116,7 +116,7 @@ public:
 
        // Public member functions
        wxTable(wxDB *pwxDB, const char *tblName, const int nCols, const char *qryTblName = 0);
-       ~wxTable();
+       virtual ~wxTable();
        bool    Open(void);
        bool    CreateTable(void);
        bool    CreateIndex(char * idxName, bool unique, int noIdxCols, CidxDef *pIdxDefs);
index b6dc66390ab957984bcede18036b16ee55d35874..a05ef94c7072f39131da68486ca7a97e3b46a728 100644 (file)
 #include  <wx/wx.h>
 #endif //WX_PRECOMP
 
+#ifdef __WXGTK__
+#include "db.xpm"
+#endif
+
 #include <stdio.h>                                     // Included strictly for reading the text file with the database parameters
 
 #include       <wx/db.h>                                       // Required in the file which will get the data source connection
index f510fbf130ad3f7f5fcdb83e9b4bb7d86719ce0c..f3aa8f24f6a9e633b9245d1874499303ceea5b6e 100644 (file)
 #endif
 
 /*
-/*
-// SYNOPSIS START
-
        Contains dialog class for creating a data table lookup listbox
-
-// SYNOPSIS STOP
 */
 
 #ifndef LISTDB_DOT_H
index 9125384a3fd5df3e5312f627000faaed9e497578..080b6c44ba2b2546303d7edacea8f8c2a1b9dc76 100644 (file)
@@ -52,6 +52,8 @@
 #include <stdio.h>
 #include <string.h>
 #include <assert.h>
+#include <stdlib.h>
+#include <ctype.h>
 #include "wx/db.h"
 
 DbList *PtrBegDbList = 0;
@@ -308,94 +310,94 @@ bool wxDB::getDbInfo(void)
 {
        SWORD cb;
 
-       if (SQLGetInfo(hdbc, SQL_SERVER_NAME, dbInf.serverName, 40, &cb) != SQL_SUCCESS)
+       if (SQLGetInfo(hdbc, SQL_SERVER_NAME, (UCHAR*) dbInf.serverName, 40, &cb) != SQL_SUCCESS)
                return(DispAllErrors(henv, hdbc));
 
-       if (SQLGetInfo(hdbc, SQL_DATABASE_NAME, dbInf.databaseName, 128, &cb) != SQL_SUCCESS)
+       if (SQLGetInfo(hdbc, SQL_DATABASE_NAME, (UCHAR*) dbInf.databaseName, 128, &cb) != SQL_SUCCESS)
                return(DispAllErrors(henv, hdbc));
 
-       if (SQLGetInfo(hdbc, SQL_DBMS_NAME, dbInf.dbmsName, 40, &cb) != SQL_SUCCESS)
+       if (SQLGetInfo(hdbc, SQL_DBMS_NAME, (UCHAR*) dbInf.dbmsName, 40, &cb) != SQL_SUCCESS)
                return(DispAllErrors(henv, hdbc));
 
-       if (SQLGetInfo(hdbc, SQL_DBMS_VER, dbInf.dbmsVer, 20, &cb) != SQL_SUCCESS)
+       if (SQLGetInfo(hdbc, SQL_DBMS_VER, (UCHAR*) dbInf.dbmsVer, 20, &cb) != SQL_SUCCESS)
                return(DispAllErrors(henv, hdbc));
 
-       if (SQLGetInfo(hdbc, SQL_ACTIVE_CONNECTIONS, &dbInf.maxConnections, sizeof(dbInf.maxConnections), &cb) != SQL_SUCCESS)
+       if (SQLGetInfo(hdbc, SQL_ACTIVE_CONNECTIONS, (UCHAR*) &dbInf.maxConnections, sizeof(dbInf.maxConnections), &cb) != SQL_SUCCESS)
                return(DispAllErrors(henv, hdbc));
 
-       if (SQLGetInfo(hdbc, SQL_ACTIVE_STATEMENTS, &dbInf.maxStmts, sizeof(dbInf.maxStmts), &cb) != SQL_SUCCESS)
+       if (SQLGetInfo(hdbc, SQL_ACTIVE_STATEMENTS, (UCHAR*) &dbInf.maxStmts, sizeof(dbInf.maxStmts), &cb) != SQL_SUCCESS)
                return(DispAllErrors(henv, hdbc));
 
-       if (SQLGetInfo(hdbc, SQL_DRIVER_NAME, dbInf.driverName, 40, &cb) != SQL_SUCCESS)
+       if (SQLGetInfo(hdbc, SQL_DRIVER_NAME, (UCHAR*) dbInf.driverName, 40, &cb) != SQL_SUCCESS)
                return(DispAllErrors(henv, hdbc));
 
-       if (SQLGetInfo(hdbc, SQL_DRIVER_ODBC_VER, dbInf.odbcVer, 20, &cb) != SQL_SUCCESS)
+       if (SQLGetInfo(hdbc, SQL_DRIVER_ODBC_VER, (UCHAR*) dbInf.odbcVer, 20, &cb) != SQL_SUCCESS)
                return(DispAllErrors(henv, hdbc));
 
-       if (SQLGetInfo(hdbc, SQL_ODBC_VER, dbInf.drvMgrOdbcVer, 20, &cb) != SQL_SUCCESS)
+       if (SQLGetInfo(hdbc, SQL_ODBC_VER, (UCHAR*) dbInf.drvMgrOdbcVer, 20, &cb) != SQL_SUCCESS)
                return(DispAllErrors(henv, hdbc));
 
-       if (SQLGetInfo(hdbc, SQL_DRIVER_VER, dbInf.driverVer, 40, &cb) != SQL_SUCCESS)
+       if (SQLGetInfo(hdbc, SQL_DRIVER_VER, (UCHAR*) dbInf.driverVer, 40, &cb) != SQL_SUCCESS)
                return(DispAllErrors(henv, hdbc));
 
-       if (SQLGetInfo(hdbc, SQL_ODBC_API_CONFORMANCE, &dbInf.apiConfLvl, sizeof(dbInf.apiConfLvl), &cb) != SQL_SUCCESS)
+       if (SQLGetInfo(hdbc, SQL_ODBC_API_CONFORMANCE, (UCHAR*) &dbInf.apiConfLvl, sizeof(dbInf.apiConfLvl), &cb) != SQL_SUCCESS)
                return(DispAllErrors(henv, hdbc));
 
-       if (SQLGetInfo(hdbc, SQL_ODBC_SAG_CLI_CONFORMANCE, &dbInf.cliConfLvl, sizeof(dbInf.cliConfLvl), &cb) != SQL_SUCCESS)
+       if (SQLGetInfo(hdbc, SQL_ODBC_SAG_CLI_CONFORMANCE, (UCHAR*) &dbInf.cliConfLvl, sizeof(dbInf.cliConfLvl), &cb) != SQL_SUCCESS)
                return(DispAllErrors(henv, hdbc));
 
-       if (SQLGetInfo(hdbc, SQL_ODBC_SQL_CONFORMANCE, &dbInf.sqlConfLvl, sizeof(dbInf.sqlConfLvl), &cb) != SQL_SUCCESS)
+       if (SQLGetInfo(hdbc, SQL_ODBC_SQL_CONFORMANCE, (UCHAR*) &dbInf.sqlConfLvl, sizeof(dbInf.sqlConfLvl), &cb) != SQL_SUCCESS)
                return(DispAllErrors(henv, hdbc));
 
-       if (SQLGetInfo(hdbc, SQL_OUTER_JOINS, dbInf.outerJoins, 2, &cb) != SQL_SUCCESS)
+       if (SQLGetInfo(hdbc, SQL_OUTER_JOINS, (UCHAR*) dbInf.outerJoins, 2, &cb) != SQL_SUCCESS)
                return(DispAllErrors(henv, hdbc));
 
-       if (SQLGetInfo(hdbc, SQL_PROCEDURES, dbInf.procedureSupport, 2, &cb) != SQL_SUCCESS)
+       if (SQLGetInfo(hdbc, SQL_PROCEDURES, (UCHAR*) dbInf.procedureSupport, 2, &cb) != SQL_SUCCESS)
                return(DispAllErrors(henv, hdbc));
 
-       if (SQLGetInfo(hdbc, SQL_CURSOR_COMMIT_BEHAVIOR, &dbInf.cursorCommitBehavior, sizeof(dbInf.cursorCommitBehavior), &cb) != SQL_SUCCESS)
+       if (SQLGetInfo(hdbc, SQL_CURSOR_COMMIT_BEHAVIOR, (UCHAR*) &dbInf.cursorCommitBehavior, sizeof(dbInf.cursorCommitBehavior), &cb) != SQL_SUCCESS)
                return(DispAllErrors(henv, hdbc));
 
-       if (SQLGetInfo(hdbc, SQL_CURSOR_ROLLBACK_BEHAVIOR, &dbInf.cursorRollbackBehavior, sizeof(dbInf.cursorRollbackBehavior), &cb) != SQL_SUCCESS)
+       if (SQLGetInfo(hdbc, SQL_CURSOR_ROLLBACK_BEHAVIOR, (UCHAR*) &dbInf.cursorRollbackBehavior, sizeof(dbInf.cursorRollbackBehavior), &cb) != SQL_SUCCESS)
                return(DispAllErrors(henv, hdbc));
 
-       if (SQLGetInfo(hdbc, SQL_NON_NULLABLE_COLUMNS, &dbInf.supportNotNullClause, sizeof(dbInf.supportNotNullClause), &cb) != SQL_SUCCESS)
+       if (SQLGetInfo(hdbc, SQL_NON_NULLABLE_COLUMNS, (UCHAR*) &dbInf.supportNotNullClause, sizeof(dbInf.supportNotNullClause), &cb) != SQL_SUCCESS)
                return(DispAllErrors(henv, hdbc));
 
-       if (SQLGetInfo(hdbc, SQL_ODBC_SQL_OPT_IEF, dbInf.supportIEF, 2, &cb) != SQL_SUCCESS)
+       if (SQLGetInfo(hdbc, SQL_ODBC_SQL_OPT_IEF, (UCHAR*) dbInf.supportIEF, 2, &cb) != SQL_SUCCESS)
                return(DispAllErrors(henv, hdbc));
 
-       if (SQLGetInfo(hdbc, SQL_DEFAULT_TXN_ISOLATION, &dbInf.txnIsolation, sizeof(dbInf.txnIsolation), &cb) != SQL_SUCCESS)
+       if (SQLGetInfo(hdbc, SQL_DEFAULT_TXN_ISOLATION, (UCHAR*) &dbInf.txnIsolation, sizeof(dbInf.txnIsolation), &cb) != SQL_SUCCESS)
                return(DispAllErrors(henv, hdbc));
 
-       if (SQLGetInfo(hdbc, SQL_TXN_ISOLATION_OPTION, &dbInf.txnIsolationOptions, sizeof(dbInf.txnIsolationOptions), &cb) != SQL_SUCCESS)
+       if (SQLGetInfo(hdbc, SQL_TXN_ISOLATION_OPTION, (UCHAR*) &dbInf.txnIsolationOptions, sizeof(dbInf.txnIsolationOptions), &cb) != SQL_SUCCESS)
                return(DispAllErrors(henv, hdbc));
 
-       if (SQLGetInfo(hdbc, SQL_FETCH_DIRECTION, &dbInf.fetchDirections, sizeof(dbInf.fetchDirections), &cb) != SQL_SUCCESS)
+       if (SQLGetInfo(hdbc, SQL_FETCH_DIRECTION, (UCHAR*) &dbInf.fetchDirections, sizeof(dbInf.fetchDirections), &cb) != SQL_SUCCESS)
                return(DispAllErrors(henv, hdbc));
 
-       if (SQLGetInfo(hdbc, SQL_LOCK_TYPES, &dbInf.lockTypes, sizeof(dbInf.lockTypes), &cb) != SQL_SUCCESS)
+       if (SQLGetInfo(hdbc, SQL_LOCK_TYPES, (UCHAR*) &dbInf.lockTypes, sizeof(dbInf.lockTypes), &cb) != SQL_SUCCESS)
                return(DispAllErrors(henv, hdbc));
 
-       if (SQLGetInfo(hdbc, SQL_POS_OPERATIONS, &dbInf.posOperations, sizeof(dbInf.posOperations), &cb) != SQL_SUCCESS)
+       if (SQLGetInfo(hdbc, SQL_POS_OPERATIONS, (UCHAR*) &dbInf.posOperations, sizeof(dbInf.posOperations), &cb) != SQL_SUCCESS)
                return(DispAllErrors(henv, hdbc));
 
-       if (SQLGetInfo(hdbc, SQL_POSITIONED_STATEMENTS, &dbInf.posStmts, sizeof(dbInf.posStmts), &cb) != SQL_SUCCESS)
+       if (SQLGetInfo(hdbc, SQL_POSITIONED_STATEMENTS, (UCHAR*) &dbInf.posStmts, sizeof(dbInf.posStmts), &cb) != SQL_SUCCESS)
                return(DispAllErrors(henv, hdbc));
 
-       if (SQLGetInfo(hdbc, SQL_SCROLL_CONCURRENCY, &dbInf.scrollConcurrency, sizeof(dbInf.scrollConcurrency), &cb) != SQL_SUCCESS)
+       if (SQLGetInfo(hdbc, SQL_SCROLL_CONCURRENCY, (UCHAR*) &dbInf.scrollConcurrency, sizeof(dbInf.scrollConcurrency), &cb) != SQL_SUCCESS)
                return(DispAllErrors(henv, hdbc));
 
-       if (SQLGetInfo(hdbc, SQL_SCROLL_OPTIONS, &dbInf.scrollOptions, sizeof(dbInf.scrollOptions), &cb) != SQL_SUCCESS)
+       if (SQLGetInfo(hdbc, SQL_SCROLL_OPTIONS, (UCHAR*) &dbInf.scrollOptions, sizeof(dbInf.scrollOptions), &cb) != SQL_SUCCESS)
                return(DispAllErrors(henv, hdbc));
 
-       if (SQLGetInfo(hdbc, SQL_STATIC_SENSITIVITY, &dbInf.staticSensitivity, sizeof(dbInf.staticSensitivity), &cb) != SQL_SUCCESS)
+       if (SQLGetInfo(hdbc, SQL_STATIC_SENSITIVITY, (UCHAR*) &dbInf.staticSensitivity, sizeof(dbInf.staticSensitivity), &cb) != SQL_SUCCESS)
                return(DispAllErrors(henv, hdbc));
 
-       if (SQLGetInfo(hdbc, SQL_TXN_CAPABLE, &dbInf.txnCapable, sizeof(dbInf.txnCapable), &cb) != SQL_SUCCESS)
+       if (SQLGetInfo(hdbc, SQL_TXN_CAPABLE, (UCHAR*) &dbInf.txnCapable, sizeof(dbInf.txnCapable), &cb) != SQL_SUCCESS)
                return(DispAllErrors(henv, hdbc));
 
-       if (SQLGetInfo(hdbc, SQL_LOGIN_TIMEOUT, &dbInf.loginTimeout, sizeof(dbInf.loginTimeout), &cb) != SQL_SUCCESS)
+       if (SQLGetInfo(hdbc, SQL_LOGIN_TIMEOUT, (UCHAR*) &dbInf.loginTimeout, sizeof(dbInf.loginTimeout), &cb) != SQL_SUCCESS)
                return(DispAllErrors(henv, hdbc));
 
 #ifdef DBDEBUG_CONSOLE
@@ -625,15 +627,15 @@ bool wxDB::getDataTypeInfo(SWORD fSqlType, SqlTypeInfo &structSQLTypeInfo)
                return(FALSE);
        }
        // Obtain columns from the record
-       if (SQLGetData(hstmt, 1, SQL_C_CHAR, structSQLTypeInfo.TypeName, DB_TYPE_NAME_LEN, &cbRet) != SQL_SUCCESS)
+       if (SQLGetData(hstmt, 1, SQL_C_CHAR, (UCHAR*) structSQLTypeInfo.TypeName, DB_TYPE_NAME_LEN, &cbRet) != SQL_SUCCESS)
                return(DispAllErrors(henv, hdbc, hstmt));
-       if (SQLGetData(hstmt, 3, SQL_C_LONG, &structSQLTypeInfo.Precision, 0, &cbRet) != SQL_SUCCESS)
+       if (SQLGetData(hstmt, 3, SQL_C_LONG, (UCHAR*) &structSQLTypeInfo.Precision, 0, &cbRet) != SQL_SUCCESS)
                return(DispAllErrors(henv, hdbc, hstmt));
-       if (SQLGetData(hstmt, 8, SQL_C_SHORT, &structSQLTypeInfo.CaseSensitive, 0, &cbRet) != SQL_SUCCESS)
+       if (SQLGetData(hstmt, 8, SQL_C_SHORT, (UCHAR*) &structSQLTypeInfo.CaseSensitive, 0, &cbRet) != SQL_SUCCESS)
                return(DispAllErrors(henv, hdbc, hstmt));
-//     if (SQLGetData(hstmt, 14, SQL_C_SHORT, &structSQLTypeInfo.MinimumScale, 0, &cbRet) != SQL_SUCCESS)
+//     if (SQLGetData(hstmt, 14, SQL_C_SHORT, (UCHAR*) &structSQLTypeInfo.MinimumScale, 0, &cbRet) != SQL_SUCCESS)
 //             return(DispAllErrors(henv, hdbc, hstmt));
-       if (SQLGetData(hstmt, 15, SQL_C_SHORT, &structSQLTypeInfo.MaximumScale, 0, &cbRet) != SQL_SUCCESS)
+       if (SQLGetData(hstmt, 15, SQL_C_SHORT, (UCHAR*) &structSQLTypeInfo.MaximumScale, 0, &cbRet) != SQL_SUCCESS)
                return(DispAllErrors(henv, hdbc, hstmt));
 
        if (structSQLTypeInfo.MaximumScale < 0)
@@ -1144,9 +1146,9 @@ CcolInf *wxDB::GetColumns(char *tableName[])
                                        delete [] colInf;
                                return(0);
                        }
-                       SQLBindCol(hstmt, 3, SQL_C_CHAR,   tblName,      DB_MAX_TABLE_NAME_LEN+1,  &cb);
-                       SQLBindCol(hstmt, 4, SQL_C_CHAR,   colName,      DB_MAX_COLUMN_NAME_LEN+1, &cb);
-                       SQLBindCol(hstmt, 5, SQL_C_SSHORT, &sqlDataType, 0,                        &cb);
+                       SQLBindCol(hstmt, 3, SQL_C_CHAR,   (UCHAR*) tblName,      DB_MAX_TABLE_NAME_LEN+1,  &cb);
+                       SQLBindCol(hstmt, 4, SQL_C_CHAR,   (UCHAR*) colName,      DB_MAX_COLUMN_NAME_LEN+1, &cb);
+                       SQLBindCol(hstmt, 5, SQL_C_SSHORT, (UCHAR*) &sqlDataType, 0,                        &cb);
                        while ((retcode = SQLFetch(hstmt)) == SQL_SUCCESS)
                        {
                                if (pass == 1)  // First pass, just add up the number of columns
@@ -1217,12 +1219,12 @@ bool wxDB::Catalog(char *userID, char *fileName)
                return(FALSE);
        }
 
-       SQLBindCol(hstmt, 3, SQL_C_CHAR,   tblName,      DB_MAX_TABLE_NAME_LEN+1,  &cb);
-       SQLBindCol(hstmt, 4, SQL_C_CHAR,   colName,      DB_MAX_COLUMN_NAME_LEN+1, &cb);
-       SQLBindCol(hstmt, 5, SQL_C_SSHORT, &sqlDataType, 0,                        &cb);
-       SQLBindCol(hstmt, 6, SQL_C_CHAR,          typeName,              16,                       &cb);
-       SQLBindCol(hstmt, 7, SQL_C_SSHORT, &precision,   0,                        &cb);
-       SQLBindCol(hstmt, 8, SQL_C_SSHORT, &length,      0,                        &cb);
+       SQLBindCol(hstmt, 3, SQL_C_CHAR,   (UCHAR*) tblName,      DB_MAX_TABLE_NAME_LEN+1,  &cb);
+       SQLBindCol(hstmt, 4, SQL_C_CHAR,   (UCHAR*) colName,      DB_MAX_COLUMN_NAME_LEN+1, &cb);
+       SQLBindCol(hstmt, 5, SQL_C_SSHORT, (UCHAR*) &sqlDataType, 0,                        &cb);
+       SQLBindCol(hstmt, 6, SQL_C_CHAR,   (UCHAR*) typeName,            16,                       &cb);
+       SQLBindCol(hstmt, 7, SQL_C_SSHORT, (UCHAR*) &precision,  0,                        &cb);
+       SQLBindCol(hstmt, 8, SQL_C_SSHORT, (UCHAR*) &length,     0,                        &cb);
 
        char outStr[256];
        strcpy(tblNameSave,"");
index decce99426d45cdd62c74a4b118fee2dab83238b..166381dd6e9313bfdba61aba4037a179ce2892a7 100644 (file)
@@ -132,7 +132,7 @@ wxTable::wxTable(wxDB *pwxDB, const char *tblName, const int nCols, const char *
                        // Datasource does not support static cursors.  Driver
                        // will substitute a cursor type.  Call SQLGetStmtOption()
                        // to determine which cursor type was selected.
-                       if (SQLGetStmtOption(c1, SQL_CURSOR_TYPE, &cursorType) != SQL_SUCCESS)
+                       if (SQLGetStmtOption(c1, SQL_CURSOR_TYPE, (UCHAR*) &cursorType) != SQL_SUCCESS)
                                pDb->DispAllErrors(henv, hdbc, c1);
 #ifdef _CONSOLE
                        cout << "Static cursor changed to: ";
@@ -494,7 +494,7 @@ UWORD wxTable::GetRowNum(void)
 {
        UDWORD rowNum;
 
-       if (SQLGetStmtOption(hstmt, SQL_ROW_NUMBER, &rowNum) != SQL_SUCCESS)
+       if (SQLGetStmtOption(hstmt, SQL_ROW_NUMBER, (UCHAR*) &rowNum) != SQL_SUCCESS)
        {
                pDb->DispAllErrors(henv, hdbc, hstmt);
                return(0);
@@ -550,7 +550,7 @@ bool wxTable::bindInsertParams(void)
                        break;
                }
                if (SQLBindParameter(hstmtInsert, i+1, SQL_PARAM_INPUT, colDefs[i].SqlCtype,
-                                                                       fSqlType, precision, scale, colDefs[i].PtrDataObj, 
+                                                                       fSqlType, precision, scale, (UCHAR*) colDefs[i].PtrDataObj, 
                                                                        precision+1,&colDefs[i].CbValue) != SQL_SUCCESS)
                        return(pDb->DispAllErrors(henv, hdbc, hstmtInsert));
        }
@@ -605,7 +605,7 @@ bool wxTable::bindUpdateParams(void)
                        break;
                }
                if (SQLBindParameter(hstmtUpdate, colNo++, SQL_PARAM_INPUT, colDefs[i].SqlCtype,
-                                                                       fSqlType, precision, scale, colDefs[i].PtrDataObj, 
+                                                                       fSqlType, precision, scale, (UCHAR*) colDefs[i].PtrDataObj, 
                                                                        precision+1, &colDefs[i].CbValue) != SQL_SUCCESS)
                        return(pDb->DispAllErrors(henv, hdbc, hstmtUpdate));
        }
@@ -623,7 +623,7 @@ bool wxTable::bindCols(HSTMT cursor)
        // Bind each column of the table to a memory address for fetching data
        for (int i = 0; i < noCols; i++)
        {
-               if (SQLBindCol(cursor, i+1, colDefs[i].SqlCtype, colDefs[i].PtrDataObj,
+               if (SQLBindCol(cursor, i+1, colDefs[i].SqlCtype, (UCHAR*) colDefs[i].PtrDataObj,
                                                        colDefs[i].SzDataObj, &cb) != SQL_SUCCESS)
                        return(pDb->DispAllErrors(henv, hdbc, cursor));
        }
@@ -1040,7 +1040,7 @@ void wxTable::GetUpdateStmt(char *pSqlStmt, int typeOfUpd, char *pWhereClause)
                        // Get the ROWID value.  If not successful retreiving the ROWID,
                        // simply fall down through the code and build the WHERE clause
                        // based on the key fields.
-                       if (SQLGetData(hstmt, noCols+1, SQL_C_CHAR, rowid, ROWID_LEN, &cb) == SQL_SUCCESS)
+                       if (SQLGetData(hstmt, noCols+1, SQL_C_CHAR, (UCHAR*) rowid, ROWID_LEN, &cb) == SQL_SUCCESS)
                        {
                                strcat(pSqlStmt, "ROWID = '");
                                strcat(pSqlStmt, rowid);
@@ -1092,7 +1092,7 @@ void wxTable::GetDeleteStmt(char *pSqlStmt, int typeOfDel, char *pWhereClause)
                        // Get the ROWID value.  If not successful retreiving the ROWID,
                        // simply fall down through the code and build the WHERE clause
                        // based on the key fields.
-                       if (SQLGetData(hstmt, noCols+1, SQL_C_CHAR, rowid, ROWID_LEN, &cb) == SQL_SUCCESS)
+                       if (SQLGetData(hstmt, noCols+1, SQL_C_CHAR, (UCHAR*) rowid, ROWID_LEN, &cb) == SQL_SUCCESS)
                        {
                                strcat(pSqlStmt, "ROWID = '");
                                strcat(pSqlStmt, rowid);
@@ -1216,9 +1216,11 @@ bool wxTable::IsColNull(int colNo)
 
 bool wxTable::CanSelectForUpdate(void)
 {
+#ifndef __WXGTK__
        if (pDb->dbInf.posStmts & SQL_PS_SELECT_FOR_UPDATE)
                return(TRUE);
        else
+#endif
                return(FALSE);
 
 }  // wxTable::CanSelectForUpdate()
@@ -1327,7 +1329,7 @@ void wxTable::SetColDefs (int index, char *fieldName, int dataType, void *pData,
                                                                 int cType, int size, bool keyField, bool upd,
                                                                 bool insAllow, bool derivedCol)
 {
-       if (strlen(fieldName) > DB_MAX_COLUMN_NAME_LEN)  // glt 4/21/97
+       if (strlen(fieldName) > (uint)DB_MAX_COLUMN_NAME_LEN)  // glt 4/21/97
        {
                strncpy (colDefs[index].ColName, fieldName, DB_MAX_COLUMN_NAME_LEN);
                colDefs[index].ColName[DB_MAX_COLUMN_NAME_LEN] = 0;  // glt 10/23/97
@@ -1439,7 +1441,7 @@ ULONG wxTable::Count(void)
        }
 
        // Obtain the result
-       if (SQLGetData(hstmtCount, 1, SQL_C_ULONG, &l, sizeof(l), &cb) != SQL_SUCCESS)
+       if (SQLGetData(hstmtCount, 1, SQL_C_ULONG, (UCHAR*) &l, sizeof(l), &cb) != SQL_SUCCESS)
        {
                pDb->DispAllErrors(henv, hdbc, hstmtCount);
                return(0);
@@ -1480,7 +1482,7 @@ bool wxTable::Refresh(void)
                // Get the ROWID value.  If not successful retreiving the ROWID,
                // simply fall down through the code and build the WHERE clause
                // based on the key fields.
-               if (SQLGetData(hstmt, noCols+1, SQL_C_CHAR, rowid, ROWID_LEN, &cb) == SQL_SUCCESS)
+               if (SQLGetData(hstmt, noCols+1, SQL_C_CHAR, (UCHAR*) rowid, ROWID_LEN, &cb) == SQL_SUCCESS)
                {
                        strcat(whereClause, queryTableName);
                        strcat(whereClause, ".ROWID = '");
index 63d3aa69ede61d1fab08a4d06bdf5309d03b38ae..149019108e760bcdfa7b73c8acd411e32feddd9c 100644 (file)
@@ -34,7 +34,8 @@ LIB_CPP_SRC=\
  common/memory.cpp \
  common/module.cpp \
  common/object.cpp \
- common/odbc.cpp \
+ common/db.cpp \
+ common/dbtable.cpp \
  common/postscrp.cpp \
  common/prntbase.cpp \
  common/resource.cpp \
index fd430472964833204070f63d2b80a530b64eee53..68e651b9a2add6624356fee5a67581ddb26250aa 100644 (file)
@@ -1,58 +1,58 @@
-July 30, 1995, v2.00.beta: 
-       0. the first release and beta version. 
+July 30, 1995, v2.00.beta:
+        0. the first release and beta version.
 
 Sep. 11, 1995, v2.10:
-       1. Porting to AIX 3.x and 4.x, by writing dlopen(),
-          dlsym(), dlclose() interface. 
-       2. Tested on SCO OpenServer 5.x 
-       3. Awared of that, unlike s700/s800, exported function 
-          symbols on HP9000 s300/s400 will be prepended with 
-          a '_' prefix by compiler(and this '_' prefix is not
-          automatically handled by shl_findsym()). Now, it works
-          fine on s300/s400.
-       4. Support driver ODBC call tracing.
+        1. Porting to AIX 3.x and 4.x, by writing dlopen(),
+           dlsym(), dlclose() interface.
+        2. Tested on SCO OpenServer 5.x
+        3. Awared of that, unlike s700/s800, exported function
+           symbols on HP9000 s300/s400 will be prepended with
+           a '_' prefix by compiler(and this '_' prefix is not
+           automatically handled by shl_findsym()). Now, it works
+           fine on s300/s400.
+        4. Support driver ODBC call tracing.
 
 Oct. 12, 1995, v2.11:
-       5. Driver's SQLNumResultCols() will automatically be 
-          invoked in driver manager's SQLExecute(),
-          SQLExecDirect() and SQLParamData() after successfully 
-          (i.e. return SQL_SUCCESS or SQL_SUCCESS_WITH_INFO )
-          calling of their correspondent driver functions. This 
-          simplifies the state tracing/checking of the driver 
-          manager a lot and allows store procedures to return 
-          result set and also make iODBC driver manager work 
-          properly with SELECT INTO statements which actually 
-          don't return result sets.
-       6. Memory leaks are cleared.
-       7. Two bugs in dld.c for AIX are fixed 
-       8. A bug of setting tracing option is fixed.
-       9. The driver will not be unloaded by SQLDisconnect() 
-          but by SQLFreeConnect() or next SQLConnect()/
-          SQLDriverConnect()/SQLBrowsConnect() on a different 
-          driver. This will save driver's loading time if it
-          has been used by a previous connection(even there
-          is no active connection on this driver).
-       10.Another three platforms are supported:
-               FreeBSD                 2.x 
-               Concurrent Max/OS SVR4  1.x
-               DG/UX                   5.x
-       11.autoconfig and build -- shell scripts to help modifying 
-          Config.mk and building iodbc driver manager
+        5. Driver's SQLNumResultCols() will automatically be
+           invoked in driver manager's SQLExecute(),
+           SQLExecDirect() and SQLParamData() after successfully
+           (i.e. return SQL_SUCCESS or SQL_SUCCESS_WITH_INFO )
+           calling of their correspondent driver functions. This
+           simplifies the state tracing/checking of the driver
+           manager a lot and allows store procedures to return
+           result set and also make iODBC driver manager work
+           properly with SELECT INTO statements which actually
+           don't return result sets.
+        6. Memory leaks are cleared.
+        7. Two bugs in dld.c for AIX are fixed
+        8. A bug of setting tracing option is fixed.
+        9. The driver will not be unloaded by SQLDisconnect()
+           but by SQLFreeConnect() or next SQLConnect()/
+           SQLDriverConnect()/SQLBrowsConnect() on a different
+           driver. This will save driver's loading time if it
+           has been used by a previous connection(even there
+           is no active connection on this driver).
+        10.Another three platforms are supported:
+                FreeBSD                 2.x
+                Concurrent Max/OS SVR4  1.x
+                DG/UX                   5.x
+        11.autoconfig and build -- shell scripts to help modifying
+           Config.mk and building iodbc driver manager
 
 Nov. 12, 1995, v2.12
-       12.I realized that a driver manager doesn't aware of 
-          difference between a C5 (i.e. hstmt) and a C6 
-          (i.e. transaction) states. 
-       13.The link flags "-lc" has been droped from Linux ELF
-          section of Config.mk to fix a segment fault problem.
-          Now, it works fine on Slackware 2.3 and Red Hat 2.0
-          (kernel version are 1.2.xx and 1.3.xx respectively).
-       14.On FreeBSD 2.x, dlsym() doesn't handle the '_' prefix 
-          prepended to an exportting function symbol by compiler. 
-          So, CLI_NAME_PREFIX needs to be defined as "_SQL" for 
-          FreeBSD 2.x. 
-       15.Some files are renamed
-               dld.c   -> dlf.c
-               dld.h   -> dlf.h
-               confg.h -> config.h
-       16. Fix a bug on setting tracing options.
+        12.I realized that a driver manager doesn't aware of
+           difference between a C5 (i.e. hstmt) and a C6
+           (i.e. transaction) states.
+        13.The link flags "-lc" has been droped from Linux ELF
+           section of Config.mk to fix a segment fault problem.
+           Now, it works fine on Slackware 2.3 and Red Hat 2.0
+           (kernel version are 1.2.xx and 1.3.xx respectively).
+        14.On FreeBSD 2.x, dlsym() doesn't handle the '_' prefix
+           prepended to an exportting function symbol by compiler.
+           So, CLI_NAME_PREFIX needs to be defined as "_SQL" for
+           FreeBSD 2.x.
+        15.Some files are renamed
+                dld.c   -> dlf.c
+                dld.h   -> dlf.h
+                confg.h -> config.h
+        16. Fix a bug on setting tracing options.
index a92adfcd0a14748ed35dfe893b6b2e9d63f0f018..d899c1558660e0fa4db98edd586ab30111f43084 100644 (file)
@@ -1,32 +1,58 @@
-include Version.mk
-include Config.mk
+include ../Version.mk
+include ../Config.mk
 
 
 
 
 
+INCDIR  = .
+OUTFILE = iodbc
 
+CFLAGS = -O $(PIC) $(ANSI) -I$(INCDIR) -D$(DLDAPI) $(CFLAGSX)\
+       -DVERSION=\"$(VERSION)$(EXTVER)\"
 
+# ODBC adminiatator is statically linked on BSDI 3.1
+# On this one can comment the following line:
+#
+ODBCDM = $(ODBC_LIBPATH)/$(OUTFILE).$(DLSUFFIX)
 
+OBJS =  dlf.o dlproc.o herr.o henv.o hdbc.o hstmt.o connect.o prepare.o\
+       execute.o result.o fetch.o info.o catalog.o misc.o itrace.o $(OBJX)
 
+all:    $(OBJS) $(ODBCDM) $(ODBC_LIBPATH)/lib$(OUTFILE).a
+       @rm -f $(ODBC_INCLUDE)/isql.h
+       @rm -f $(ODBC_INCLUDE)/isqlext.h
+       @rm -f $(ODBC_INCLUDE)/odbc_types.h
+       @rm -f $(ODBC_INCLUDE)/odbc_funcs.h
+       cp isql.h    $(ODBC_INCLUDE)/
+       cp isqlext.h $(ODBC_INCLUDE)/
+       cp odbc_types.h $(ODBC_INCLUDE)/
+       cp odbc_funcs.h $(ODBC_INCLUDE)/
+       @echo 
+       @echo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+       @echo 
+       @echo Don\'t forget tu update $(ODBC_LIBPATH)/iodbc.ini with your conf
+       @echo 
+       @echo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+       @echo 
 
+clean:
+       \rm -f $(OBJS)
 
-INCDIR = .
-OUTDIR = $(HOME)
+delete: clean
 
-CFLAGS  = -O $(PIC) $(ANSI) -I$(INCDIR) -D$(DLDAPI) $(CFLAGSX)\
-         -DVERSION=\"$(VERSION)$(EXTVER)\" 
+delete_all: delete
 
-ODBCDM = $(OUTDIR)/$(OUTFILE)-$(VERSION).$(DLSUFFIX)
+misc.o:        misc.c
+       $(CC) $(CFLAGS) -DFIX_INI_FILE -DDIR_INI_FILE=\"$(ODBC_LIBPATH)\" -c $<
 
-OBJS = dlf.o dlproc.o herr.o henv.o hdbc.o hstmt.o \
-       connect.o prepare.o execute.o result.o \
-       fetch.o info.o catalog.o misc.o itrace.o $(OBJX)
+$(ODBC_LIBPATH)/lib$(OUTFILE).a: $(OBJS)
+       $(AR) $(ODBC_LIBPATH)/lib$(OUTFILE).a $(OBJS)
+       $(RANLIB) $(ODBC_LIBPATH)/lib$(OUTFILE).a
 
-all:   $(OBJS)
+$(ODBCDM): $(OBJS)
        @echo "Generating iODBC driver manager -->" $(ODBCDM)
-       @\rm -f $(ODBCDM)
-       @$(LD) $(LDFLAGS) $(OBJS) $(LIBS) -o $(ODBCDM)
+       @rm -f $(ODBCDM)
+       $(LD) $(LDFLAGS) -L$(ODBC_LIBPATH) $(OBJS) -o $(ODBCDM) $(LIBS)
+       if [ ! -f $(ODBC_LIBPATH)/iodbc.ini ]; then cp  iodbc.$(OS)  $(ODBC_LIBPATH)/iodbc.ini; fi
 
-clean:
-       \rm -f $(OBJS) 
index 23cb2a5e827eeb1e2e45505a363e714ada8cd5d2..ed0f3008a0919bc768ce450a2d13676ba5b24ef0 100644 (file)
 0. Changes
-       a. I realized that a driver manager doesn't aware of 
-          difference between a C5 (i.e. hstmt) and a C6 
-          (i.e. transaction) states. 
-
-       b. The link flags "-lc" has been removed from Linux ELF
-          section of Config.mk to fix a segment fault problem.
-          Now, it works fine on Slackware 2.3 and Red Hat 2.0
-          (kernel version are 1.2.xx and 1.3.xx respectively).
-          
-       c. On FreeBSD 2.x, dlsym() doesn't handle the '_' 
-          prepended before a exporting function symbol. So, 
-          CLI_NAME_PREFIX needs to be defined as "_SQL" for 
-          FreeBSD. 
-
-       d. Some files are renamed
-               dld.c   -> dlf.c
-               dld.h   -> dlf.h
-               confg.h -> config.h
+        a. I realized that a driver manager doesn't aware of
+           difference between a C5 (i.e. hstmt) and a C6
+           (i.e. transaction) states.
+
+        b. The link flags "-lc" has been removed from Linux ELF
+           section of Config.mk to fix a segment fault problem.
+           Now, it works fine on Slackware 2.3 and Red Hat 2.0
+           (kernel version are 1.2.xx and 1.3.xx respectively).
+
+        c. On FreeBSD 2.x, dlsym() doesn't handle the '_'
+           prepended before a exporting function symbol. So,
+           CLI_NAME_PREFIX needs to be defined as "_SQL" for
+           FreeBSD.
+
+        d. Some files are renamed
+                dld.c   -> dlf.c
+                dld.h   -> dlf.h
+                confg.h -> config.h
 
 1. iODBC driver manager platform availability
 
-   iODBC driver manager has been ported to following Unix platforms: 
-
-       SunOS           4.1.x           Sun Sparc
-       HP/UX           9.x, 10.x       HP9000 s700/s800
-       HP/UX           9.x             HP9000 s300/s400                
-       IBM AIX         3.x, 4.x        IBM RS6000, PowerPC
-       Sun Solaris     2.x             Sun Sparc, PCx86
-       SGI Irix SVR4   5.x, 6.x        IP12 MIPS, IP22 MIPS
-       NCR SVR4        3.x             NCR 3435
-       UnixWare SVR4.2 1.x, 2.x        x86
-       DEC Unix(OSF/1) 3.x, 4.x        DEC Alpha
-       FreeBSD         2.x             x86
-       BSDI BSD/OS     2.x             ?
-       Linux ELF       1.2.x, 1.3.x    x86
-       SCO OpenServer  5.x             x86
-       Max/OS SVR4     1.x             Concurrent Maxion 9200 MP
-       DG/UX           5.x             Aviion
+   iODBC driver manager has been ported to following Unix platforms:
+
+        SunOS           4.1.x           Sun Sparc
+        HP/UX           9.x, 10.x       HP9000 s700/s800
+        HP/UX           9.x             HP9000 s300/s400
+        IBM AIX         3.x, 4.x        IBM RS6000, PowerPC
+        Sun Solaris     2.x             Sun Sparc, PCx86
+        SGI Irix SVR4   5.x, 6.x        IP12 MIPS, IP22 MIPS
+        NCR SVR4        3.x             NCR 3435
+        UnixWare SVR4.2 1.x, 2.x        x86
+        DEC Unix(OSF/1) 3.x, 4.x        DEC Alpha
+        FreeBSD         2.x             x86
+        BSDI BSD/OS     2.x             ?
+        Linux ELF       1.2.x, 1.3.x    x86
+        SCO OpenServer  5.x             x86
+        Max/OS SVR4     1.x             Concurrent Maxion 9200 MP
+        DG/UX           5.x             Aviion
 
    Porting of iODBC driver manager to some non-unix operating systems
-   such as Windows family(3.x, 95, NT), OS/2 and Mac is supported but 
-   has never compiled and tested yet :). Of cause, you need to supply 
+   such as Windows family(3.x, 95, NT), OS/2 and Mac is supported but
+   has never compiled and tested yet :). Of cause, you need to supply
    a make/build file and a short LibMain for creating the iodbc.dll.
 
 2. How to build iODBC driver manager:
 
-       step 1. Identify your system
-       step 2. Run build with a suitable option
-   
+        step 1. Identify your system
+        step 2. Run build with a suitable option
+
    Here is an example:
 
-       %[1]: sh iodbc-2.12.shar
-       ....
-       %[2]: cd iodbc-2.12
-       %[3]: uname -s -v -r -m
-       HP-UX B.10.01 A 9000/710
-       %[4]: ./build hp700
-       autoconfig hp700
-       make
-       ....
-       Generating iODBC driver manager --> /home/kejin/iodbc-2.12.sl
+        %[1]: sh iodbc-2.12.shar
+        ....
+        %[2]: cd iodbc-2.12
+        %[3]: uname -s -v -r -m
+        HP-UX B.10.01 A 9000/710
+        %[4]: ./build hp700
+        autoconfig hp700
+        make
+        ....
+        Generating iODBC driver manager --> /home/kejin/iodbc-2.12.sl
 
 3. odbc.ini( ~/.odbc.ini )
 
-   Driver manager and drivers use odbc.ini(or ~/.odbc.ini on Unix) file 
+   Driver manager and drivers use odbc.ini(or ~/.odbc.ini on Unix) file
    or connection string when establishing a data source connection. On
-   Windows, odbc.ini is located in Windows directory. On unix, iODBC driver 
-   manager(and all other ODBC drivers and driver managers I awared) looks 
-   .odbc.ini file in real user's home directory (it could be a softlink to 
-   the file located somewhere else). Make sure your driver will look into 
-   the same file (or a file which is a symbolic link to the same file).  
+   Windows, odbc.ini is located in Windows directory. On unix, iODBC driver
+   manager(and all other ODBC drivers and driver managers I awared) looks
+   .odbc.ini file in real user's home directory (it could be a softlink to
+   the file located somewhere else). Make sure your driver will look into
+   the same file (or a file which is a symbolic link to the same file).
    The format of odbc.ini( or ~/.odbc.ini ) is defined as:
 
-       odbc.ini(or .odbc.ini) ::= data_source_list
+        odbc.ini(or .odbc.ini) ::= data_source_list
 
-       data_source_list ::= /* empty */
-                          | data_source '\n' data_source_list
+        data_source_list ::= /* empty */
+                           | data_source '\n' data_source_list
 
-       data_source ::= '[' data_source_name ']' '\n' data_source_desc
+        data_source ::= '[' data_source_name ']' '\n' data_source_desc
 
-       data_source_name ::= 'default' | [A-Za-z]*[A-Za-z0-9_]*
+        data_source_name ::= 'default' | [A-Za-z]*[A-Za-z0-9_]*
 
-       data_source_desc ::= /* empty */
-                          | attrib_desc '\n' data_source_desc
+        data_source_desc ::= /* empty */
+                           | attrib_desc '\n' data_source_desc
 
-       addrib_desc ::= Attrib '=' attrib_value
+        addrib_desc ::= Attrib '=' attrib_value
 
-       Attrib ::= 'Driver' | 'PID' | 'UID' | driver_def_attrib
+        Attrib ::= 'Driver' | 'PID' | 'UID' | driver_def_attrib
 
-       driver_def_attrib ::= [A-Za-z]*[A-Za-z0-9_]*
+        driver_def_attrib ::= [A-Za-z]*[A-Za-z0-9_]*
 
    An example of .odbc.ini file:
 
-       [toronto_yp]
-       # yellow page of metro Toronto
-       Driver = /usr/lib/odbc/oracle.so
-       <....>
+        [toronto_yp]
+        # yellow page of metro Toronto
+        Driver = /usr/lib/odbc/oracle.so
+        <....>
 
-       [toronto_wp]
-       # white page of metro Toronto
-       Driver = /usr/lib/odbc/oracle.so
-       <....>
+        [toronto_wp]
+        # white page of metro Toronto
+        Driver = /usr/lib/odbc/oracle.so
+        <....>
 
-       [contract]
-       # all contract documents
-       Driver = /usr/lib/odbc/informix.so
-       <....>
+        [contract]
+        # all contract documents
+        Driver = /usr/lib/odbc/informix.so
+        <....>
 
-       [netnews]
-       # NNTP netnews group 
-       Driver = /usr/lib/odbc/nnodbc.so
-       Server = news.empress.com
+        [netnews]
+        # NNTP netnews group
+        Driver = /usr/lib/odbc/nnodbc.so
+        Server = news.empress.com
 
-       [rnd_test]
-       # data source for R&D test
-       Driver = /home/r_d/odbc/empodbc.so
-       URL = empodbc://rnd.empress.com:6322/rnd_test/testdb
+        [rnd_test]
+        # data source for R&D test
+        Driver = /home/r_d/odbc/empodbc.so
+        URL = empodbc://rnd.empress.com:6322/rnd_test/testdb
 
-       [default]
-       # default to odbc gateway
-       Driver = /usr/lib/odbc/gateway.so
+        [default]
+        # default to odbc gateway
+        Driver = /usr/lib/odbc/gateway.so
 
 4. Tracing
 
-   iODBC driver manager traces driver's ODBC call invoked by the driver 
-   manager. Default tracing file is ./odbc.log. Tracing option (i.e. 
-   on/off or optional tracing file name) can be set in ~/.odbc.ini 
+   iODBC driver manager traces driver's ODBC call invoked by the driver
+   manager. Default tracing file is ./odbc.log. Tracing option (i.e.
+   on/off or optional tracing file name) can be set in ~/.odbc.ini
    file (under a data source section) as:
 
-       TraceFile = <optional_trace_file>
-       Trace = ON | On | on | 1 | OFF | Off | off | 0
+        TraceFile = <optional_trace_file>
+        Trace = ON | On | on | 1 | OFF | Off | off | 0
 
    If <optional_trace_file> is stderr or stdout, i.e.
-   
-        TraceFile = stderr 
-   
+
+        TraceFile = stderr
+
    or
 
-       TraceFile = stdout
+        TraceFile = stdout
 
    the tracing message will go to the terminal screen(if it is available).
 
    iODBC driver manager allows one to tune on/off tracing on selected
-   connection(s). Different connections can share one or use different 
+   connection(s). Different connections can share one or use different
    tracing file(s). ODBC calls on connections without tuning tracing on
-   will not be traced. 
-       
+   will not be traced.
+
 5. File list:
 
-       README          This file
-       IAFA-PACKAGE    Version and copyright information
-       Changes.log     Source changes log
-       Version.mk      Version make include file
-       Config.mk       Config  make include file
-       Makefile        make file
-       config.h        system config include file
-       isql.h          ODBC 1.0 macro 
-       isqlext.h       ODBC 2.0 macro
-       dlf.h           general dynamic loader module interface
-       dlf.c           general dynamic loader module (mapping to svr4)
-       dlproc.h        simple dynamic loader module interface 
-       dlproc.c        simple dynamic loader on top of dlf module
-       herr.h          error handling module interface
-       herr.c          error handling module
-       herr.ci         error handling source include
-       henv.h          environment handle interface
-       henv.c          environment handle module
-       henv.ci         environment handle source include 
-       hdbc.h          connection handle interface
-       hdbc.c          connection handle module
-       hstmt.h         statement  handle interface
-       hstmt.c         statement  handle module
-       connect.c       connect functions
-       prepare.c       query prepare functions
-       execute.c       query executing functions
-       result.c        query result property functions
-       fetch.c         query result fetch functions
-       info.c          driver information functions
-       catalog.c       catalog functions
-       misc.c          miscellaneous functions
-       itrace.h        macro
-       itrace.c        trace function
-       main.c          entry function used to build a share library on AIX
-       shrsub.exp      export symbol list used on AIX
-       autoconfig      shell script for creating Config.mk
-       build           shell script for building iodbc driver manager 
+        README          This file
+        IAFA-PACKAGE    Version and copyright information
+        Changes.log     Source changes log
+        Version.mk      Version make include file
+        Config.mk       Config  make include file
+        Makefile        make file
+        config.h        system config include file
+        isql.h          ODBC 1.0 macro
+        isqlext.h       ODBC 2.0 macro
+        dlf.h           general dynamic loader module interface
+        dlf.c           general dynamic loader module (mapping to svr4)
+        dlproc.h        simple dynamic loader module interface
+        dlproc.c        simple dynamic loader on top of dlf module
+        herr.h          error handling module interface
+        herr.c          error handling module
+        herr.ci         error handling source include
+        henv.h          environment handle interface
+        henv.c          environment handle module
+        henv.ci         environment handle source include
+        hdbc.h          connection handle interface
+        hdbc.c          connection handle module
+        hstmt.h         statement  handle interface
+        hstmt.c         statement  handle module
+        connect.c       connect functions
+        prepare.c       query prepare functions
+        execute.c       query executing functions
+        result.c        query result property functions
+        fetch.c         query result fetch functions
+        info.c          driver information functions
+        catalog.c       catalog functions
+        misc.c          miscellaneous functions
+        itrace.h        macro
+        itrace.c        trace function
+        main.c          entry function used to build a share library on AIX
+        shrsub.exp      export symbol list used on AIX
+        autoconfig      shell script for creating Config.mk
+        build           shell script for building iodbc driver manager
index 0d85940454bf89cf7cf7028112a0cd084d088440..6c28eabdcfd9545fbe0bbab0d79eb121d06fc9e7 100644 (file)
@@ -1,6 +1,6 @@
 /** Catalog functions of iODBC driver manager
 
-    Copyright (C) 1995 by Ke Jin <kejin@empress.com> 
+    Copyright (C) 1995 by Ke Jin <kejin@empress.com>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 
 #include       <../iodbc/itrace.h>
 
-static RETCODE _iodbcdm_cata_state_ok ( 
-                               HSTMT   hstmt, 
-                               int     fidx )
+static RETCODE  _iodbcdm_cata_state_ok (
+                                HSTMT   hstmt,
+                                int     fidx )
 /* check state for executing catalog functions */
 {
-       STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
-       int             sqlstat = en_00000;
-
-       if( pstmt->asyn_on == en_NullProc )
-       {
-               switch( pstmt->state )
-               {
-                       case en_stmt_needdata:
-                       case en_stmt_mustput:
-                       case en_stmt_canput:
-                               sqlstat = en_S1010;
-                               break;
-
-                       case en_stmt_fetched:
-                       case en_stmt_xfetched:
-                               sqlstat = en_24000;
-                               break;
-
-                       default:
-                               break;
-               }
-       }
-       else if( pstmt->asyn_on != fidx )
-       {
-               sqlstat = en_S1010;
-       }
-
-       if( sqlstat != en_00000 )
-       {
-               PUSHSQLERR ( pstmt->herr, sqlstat );
-
-               return SQL_ERROR;
-       }
-
-       return SQL_SUCCESS;
+        STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
+        int             sqlstat = en_00000;
+
+        if( pstmt->asyn_on == en_NullProc )
+        {
+                switch( pstmt->state )
+                {
+                        case en_stmt_needdata:
+                        case en_stmt_mustput:
+                        case en_stmt_canput:
+                                sqlstat = en_S1010;
+                                break;
+
+                        case en_stmt_fetched:
+                        case en_stmt_xfetched:
+                                sqlstat = en_24000;
+                                break;
+
+                        default:
+                                break;
+                }
+        }
+        else if( pstmt->asyn_on != fidx )
+        {
+                sqlstat = en_S1010;
+        }
+
+        if( sqlstat != en_00000 )
+        {
+                PUSHSQLERR ( pstmt->herr, sqlstat );
+
+                return SQL_ERROR;
+        }
+
+        return SQL_SUCCESS;
 }
 
-static RETCODE _iodbcdm_cata_state_tr( 
-                       HSTMT           hstmt, 
-                       int             fidx, 
-                       RETCODE         result )
+static RETCODE  _iodbcdm_cata_state_tr(
+                        HSTMT           hstmt,
+                        int             fidx,
+                        RETCODE         result )
 /* state transition for catalog function */
 {
-       STMT_t FAR*     pstmt = (STMT_t FAR*)hstmt;
-       DBC_t  FAR*     pdbc;
-
-       pdbc = (DBC_t FAR*)(pstmt->hdbc);
-
-       if( pstmt->asyn_on == fidx )
-       {
-               switch( result )
-               {
-                       case SQL_SUCCESS:
-                       case SQL_SUCCESS_WITH_INFO:
-                       case SQL_ERROR:
-                               pstmt->asyn_on = en_NullProc;
-                               break;
-
-                       case SQL_STILL_EXECUTING:
-                       default:
-                               return result;
-               }
-       }
-
-       if( pstmt->state <= en_stmt_executed )
-       {
-               switch( result )
-               {
-                       case SQL_SUCCESS:
-                       case SQL_SUCCESS_WITH_INFO:
-                               pstmt->state = en_stmt_cursoropen;
-                               break;
-
-                       case SQL_ERROR:
-                               pstmt->state = en_stmt_allocated;
-                               pstmt->prep_state = 0;
-                               break;
-
-                       case SQL_STILL_EXECUTING:
-                               pstmt->asyn_on = fidx;
-                               break;
-
-                       default:
-                               break;
-               }
-       }
-
-       return result;
+        STMT_t FAR*     pstmt = (STMT_t FAR*)hstmt;
+        DBC_t  FAR*     pdbc;
+
+        pdbc = (DBC_t FAR*)(pstmt->hdbc);
+
+        if( pstmt->asyn_on == fidx )
+        {
+                switch( result )
+                {
+                        case SQL_SUCCESS:
+                        case SQL_SUCCESS_WITH_INFO:
+                        case SQL_ERROR:
+                                pstmt->asyn_on = en_NullProc;
+                                break;
+
+                        case SQL_STILL_EXECUTING:
+                        default:
+                                return result;
+                }
+        }
+
+        if( pstmt->state <= en_stmt_executed )
+        {
+                switch( result )
+                {
+                        case SQL_SUCCESS:
+                        case SQL_SUCCESS_WITH_INFO:
+                                pstmt->state = en_stmt_cursoropen;
+                                break;
+
+                        case SQL_ERROR:
+                                pstmt->state = en_stmt_allocated;
+                                pstmt->prep_state = 0;
+                                break;
+
+                        case SQL_STILL_EXECUTING:
+                                pstmt->asyn_on = fidx;
+                                break;
+
+                        default:
+                                break;
+                }
+        }
+
+        return result;
 }
 
 RETCODE SQL_API SQLGetTypeInfo(
-                       HSTMT           hstmt,
-                       SWORD           fSqlType )
+                        HSTMT           hstmt,
+                        SWORD           fSqlType )
 {
-       STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
-       HPROC           hproc   = SQL_NULL_HPROC;
-       int             sqlstat = en_00000;
-       RETCODE         retcode;
-
-       if( hstmt == SQL_NULL_HSTMT
-        || pstmt->hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       for(;;)
-       {
-               if( fSqlType > SQL_TYPE_MAX )
-               {
-                       sqlstat = en_S1004;
-                       break;
-               }
-
-               if( fSqlType < SQL_TYPE_MIN 
-                && fSqlType > SQL_TYPE_DRIVER_START ) 
-               /* Note: SQL_TYPE_DRIVER_START is a nagtive 
-                * number So, we use ">" */
-               {
-                       sqlstat = en_S1004;
-                       break;
-               }
-
-               retcode = _iodbcdm_cata_state_ok( hstmt, en_GetTypeInfo );
-               
-               if( retcode != SQL_SUCCESS )
-               {
-                       return SQL_ERROR;
-               }
-
-               hproc = _iodbcdm_getproc ( pstmt->hdbc, en_GetTypeInfo );
-
-               if( hproc == SQL_NULL_HPROC )
-               {
-                       sqlstat = en_IM001;
-                       break;
-               }
-
-               sqlstat = en_00000;
-               if( 1 ) /* turn off solaris warning message */
-                       break;
-       }
-
-       if( sqlstat != en_00000 )
-       {
-               PUSHSQLERR ( pstmt->herr, sqlstat );
-
-               return SQL_ERROR;
-       }
-
-       CALL_DRIVER ( pstmt->hdbc, retcode, hproc, 
-               en_GetTypeInfo, ( pstmt->dhstmt, fSqlType) )
+        STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
+        HPROC           hproc;
+        int             sqlstat = en_00000;
+        RETCODE         retcode;
+
+        if( hstmt == SQL_NULL_HSTMT
+         || pstmt->hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        for(;;)
+        {
+                if( fSqlType > SQL_TYPE_MAX )
+                {
+                        sqlstat = en_S1004;
+                        break;
+                }
+
+                if( fSqlType < SQL_TYPE_MIN
+                 && fSqlType > SQL_TYPE_DRIVER_START )
+                /* Note: SQL_TYPE_DRIVER_START is a nagtive
+                 * number So, we use ">" */
+                {
+                        sqlstat = en_S1004;
+                        break;
+                }
+
+                retcode = _iodbcdm_cata_state_ok( hstmt, en_GetTypeInfo );
+
+                if( retcode != SQL_SUCCESS )
+                {
+                        return SQL_ERROR;
+                }
+
+                hproc = _iodbcdm_getproc ( pstmt->hdbc, en_GetTypeInfo );
+
+                if( hproc == SQL_NULL_HPROC )
+                {
+                        sqlstat = en_IM001;
+                        break;
+                }
+
+                sqlstat = en_00000;
+                if( 1 ) /* turn off solaris warning message */
+                        break;
+        }
+
+        if( sqlstat != en_00000 )
+        {
+                PUSHSQLERR ( pstmt->herr, sqlstat );
+
+                return SQL_ERROR;
+        }
+
+        CALL_DRIVER ( pstmt->hdbc, retcode, hproc,
+                en_GetTypeInfo, ( pstmt->dhstmt, fSqlType) )
 
 #if 0
-       retcode = hproc ( pstmt->dhstmt, fSqlType );
+        retcode = hproc ( pstmt->dhstmt, fSqlType );
 #endif
 
-       return _iodbcdm_cata_state_tr( hstmt, en_GetTypeInfo, retcode );
+        return _iodbcdm_cata_state_tr( hstmt, en_GetTypeInfo, retcode );
 }
 
-RETCODE SQL_API        SQLSpecialColumns(
-                       HSTMT           hstmt,
-                       UWORD           fColType,
-                       UCHAR FAR*      szTableQualifier,
-                       SWORD           cbTableQualifier,
-                       UCHAR FAR*      szTableOwner,
-                       SWORD           cbTableOwner,
-                       UCHAR FAR*      szTableName, 
-                       SWORD           cbTableName, 
-                       UWORD           fScope,
-                       UWORD           fNullable )
+RETCODE SQL_API SQLSpecialColumns(
+                        HSTMT           hstmt,
+                        UWORD           fColType,
+                        UCHAR FAR*      szTableQualifier,
+                        SWORD           cbTableQualifier,
+                        UCHAR FAR*      szTableOwner,
+                        SWORD           cbTableOwner,
+                        UCHAR FAR*      szTableName,
+                        SWORD           cbTableName,
+                        UWORD           fScope,
+                        UWORD           fNullable )
 {
-       STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
-       HPROC           hproc   = SQL_NULL_HPROC;
-       RETCODE         retcode;
-       int             sqlstat = en_00000;
-
-       if( hstmt == SQL_NULL_HSTMT
-        || pstmt->hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       for(;;)
-       {
-               if( ( cbTableQualifier < 0 && cbTableQualifier != SQL_NTS )
-                || ( cbTableOwner     < 0 && cbTableOwner     != SQL_NTS )
-                || ( cbTableName      < 0 && cbTableName      != SQL_NTS ) )
-               {
-                       sqlstat = en_S1090;
-                       break;
-               }
-
-               if( fColType != SQL_BEST_ROWID 
-                && fColType != SQL_ROWVER )
-               {
-                       sqlstat = en_S1097;
-                       break;
-               }
-
-               if( fScope != SQL_SCOPE_CURROW 
-                && fScope != SQL_SCOPE_TRANSACTION 
-                && fScope != SQL_SCOPE_SESSION )
-               {
-                       sqlstat = en_S1098;
-                       break;
-               }
-
-               if( fNullable != SQL_NO_NULLS
-                && fNullable != SQL_NULLABLE )
-               {
-                       sqlstat = en_S1099;
-                       break;
-               }
-
-               retcode = _iodbcdm_cata_state_ok ( hstmt, en_SpecialColumns );
-               
-               if( retcode != SQL_SUCCESS )
-               {
-                       return SQL_ERROR;
-               }
-
-               hproc = _iodbcdm_getproc( pstmt->hdbc, en_SpecialColumns );
-
-               if( hproc == SQL_NULL_HPROC )
-               {
-                       sqlstat = en_IM001;
-                       break;
-               }
-
-               sqlstat = en_00000;
-               if( 1 ) /* turn off solaris warning message */
-                       break;
-       }
-
-       if( sqlstat != en_00000 )
-       {
-               PUSHSQLERR ( pstmt->herr, sqlstat );
-
-               return SQL_ERROR;
-       }
-
-       CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_SpecialColumns, ( 
-                       pstmt->dhstmt,
-                       fColType,
-                       szTableQualifier,
-                       cbTableQualifier,
-                       szTableOwner,
-                       cbTableOwner,
-                       szTableName,
-                       cbTableName,
-                       fScope,
-                       fNullable ) )
+        STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
+        HPROC           hproc;
+        RETCODE         retcode;
+        int             sqlstat = en_00000;
+
+        if( hstmt == SQL_NULL_HSTMT
+         || pstmt->hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        for(;;)
+        {
+                if( ( cbTableQualifier < 0 && cbTableQualifier != SQL_NTS )
+                 || ( cbTableOwner     < 0 && cbTableOwner     != SQL_NTS )
+                 || ( cbTableName      < 0 && cbTableName      != SQL_NTS ) )
+                {
+                        sqlstat = en_S1090;
+                        break;
+                }
+
+                if( fColType != SQL_BEST_ROWID
+                 && fColType != SQL_ROWVER )
+                {
+                        sqlstat = en_S1097;
+                        break;
+                }
+
+                if( fScope != SQL_SCOPE_CURROW
+                 && fScope != SQL_SCOPE_TRANSACTION
+                 && fScope != SQL_SCOPE_SESSION )
+                {
+                        sqlstat = en_S1098;
+                        break;
+                }
+
+                if( fNullable != SQL_NO_NULLS
+                 && fNullable != SQL_NULLABLE )
+                {
+                        sqlstat = en_S1099;
+                        break;
+                }
+
+                retcode = _iodbcdm_cata_state_ok ( hstmt, en_SpecialColumns );
+
+                if( retcode != SQL_SUCCESS )
+                {
+                        return SQL_ERROR;
+                }
+
+                hproc = _iodbcdm_getproc( pstmt->hdbc, en_SpecialColumns );
+
+                if( hproc == SQL_NULL_HPROC )
+                {
+                        sqlstat = en_IM001;
+                        break;
+                }
+
+                sqlstat = en_00000;
+                if( 1 ) /* turn off solaris warning message */
+                        break;
+        }
+
+        if( sqlstat != en_00000 )
+        {
+                PUSHSQLERR ( pstmt->herr, sqlstat );
+
+                return SQL_ERROR;
+        }
+
+        CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_SpecialColumns, (
+                        pstmt->dhstmt,
+                        fColType,
+                        szTableQualifier,
+                        cbTableQualifier,
+                        szTableOwner,
+                        cbTableOwner,
+                        szTableName,
+                        cbTableName,
+                        fScope,
+                        fNullable ) )
 
 #if 0
-       retcode = hproc(pstmt->dhstmt,
-                       fColType,
-                       szTableQualifier,
-                       cbTableQualifier,
-                       szTableOwner,
-                       cbTableOwner,
-                       szTableName,
-                       cbTableName,
-                       fScope,
-                       fNullable );
+        retcode = hproc(pstmt->dhstmt,
+                        fColType,
+                        szTableQualifier,
+                        cbTableQualifier,
+                        szTableOwner,
+                        cbTableOwner,
+                        szTableName,
+                        cbTableName,
+                        fScope,
+                        fNullable );
 #endif
 
-       return _iodbcdm_cata_state_tr( hstmt, en_SpecialColumns, retcode );
+        return _iodbcdm_cata_state_tr( hstmt, en_SpecialColumns, retcode );
 }
 
-RETCODE SQL_API        SQLStatistics(
-                       HSTMT           hstmt,
-                       UCHAR FAR*      szTableQualifier,
-                       SWORD           cbTableQualifier,
-                       UCHAR FAR*      szTableOwner,
-                       SWORD           cbTableOwner, 
-                       UCHAR FAR*      szTableName,
-                       SWORD           cbTableName,
-                       UWORD           fUnique, 
-                       UWORD           fAccuracy )
+RETCODE SQL_API SQLStatistics(
+                        HSTMT           hstmt,
+                        UCHAR FAR*      szTableQualifier,
+                        SWORD           cbTableQualifier,
+                        UCHAR FAR*      szTableOwner,
+                        SWORD           cbTableOwner,
+                        UCHAR FAR*      szTableName,
+                        SWORD           cbTableName,
+                        UWORD           fUnique,
+                        UWORD           fAccuracy )
 {
-       STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
-       HPROC           hproc   = SQL_NULL_HPROC;
-       RETCODE         retcode;
-       int             sqlstat = en_00000;
-
-       if( hstmt == SQL_NULL_HSTMT
-        || pstmt->hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       for(;;)
-       {
-               if( ( cbTableQualifier < 0 && cbTableQualifier != SQL_NTS )
-                || ( cbTableOwner     < 0 && cbTableOwner     != SQL_NTS )
-                || ( cbTableName      < 0 && cbTableName      != SQL_NTS ) )
-               {
-                       sqlstat = en_S1090;
-                       break;
-               }
-
-               if( fUnique != SQL_INDEX_UNIQUE
-                && fUnique != SQL_INDEX_ALL )
-               {
-                       sqlstat = en_S1100;
-                       break;
-               }
-
-               if( fAccuracy != SQL_ENSURE
-                && fAccuracy != SQL_QUICK )
-               {
-                       sqlstat = en_S1101;
-                       break;
-               }
-
-               retcode = _iodbcdm_cata_state_ok ( hstmt, en_Statistics );
-               
-               if( retcode != SQL_SUCCESS )
-               {
-                       return SQL_ERROR;
-               }
-
-               hproc = _iodbcdm_getproc( pstmt->hdbc, en_Statistics );
-
-               if( hproc == SQL_NULL_HPROC )
-               {
-                       sqlstat = en_IM001;
-                       break;
-               }
-
-               sqlstat = en_00000;
-
-               if( 1 ) /* turn off solaris warning message */
-                       break;
-       }
-
-       if( sqlstat != en_00000 )
-       {
-               PUSHSQLERR ( pstmt->herr, sqlstat );
-
-               return SQL_ERROR;
-       }
-
-       CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_Statistics, (
-                       pstmt->dhstmt,
-                       szTableQualifier,
-                       cbTableQualifier,
-                       szTableOwner,
-                       cbTableOwner,
-                       szTableName,
-                       cbTableName,
-                       fUnique,
-                       fAccuracy ) )
+        STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
+        HPROC           hproc;
+        RETCODE         retcode;
+        int             sqlstat = en_00000;
+
+        if( hstmt == SQL_NULL_HSTMT
+         || pstmt->hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        for(;;)
+        {
+                if( ( cbTableQualifier < 0 && cbTableQualifier != SQL_NTS )
+                 || ( cbTableOwner     < 0 && cbTableOwner     != SQL_NTS )
+                 || ( cbTableName      < 0 && cbTableName      != SQL_NTS ) )
+                {
+                        sqlstat = en_S1090;
+                        break;
+                }
+
+                if( fUnique != SQL_INDEX_UNIQUE
+                 && fUnique != SQL_INDEX_ALL )
+                {
+                        sqlstat = en_S1100;
+                        break;
+                }
+
+                if( fAccuracy != SQL_ENSURE
+                 && fAccuracy != SQL_QUICK )
+                {
+                        sqlstat = en_S1101;
+                        break;
+                }
+
+                retcode = _iodbcdm_cata_state_ok ( hstmt, en_Statistics );
+
+                if( retcode != SQL_SUCCESS )
+                {
+                        return SQL_ERROR;
+                }
+
+                hproc = _iodbcdm_getproc( pstmt->hdbc, en_Statistics );
+
+                if( hproc == SQL_NULL_HPROC )
+                {
+                        sqlstat = en_IM001;
+                        break;
+                }
+
+                sqlstat = en_00000;
+
+                if( 1 ) /* turn off solaris warning message */
+                        break;
+        }
+
+        if( sqlstat != en_00000 )
+        {
+                PUSHSQLERR ( pstmt->herr, sqlstat );
+
+                return SQL_ERROR;
+        }
+
+        CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_Statistics, (
+                        pstmt->dhstmt,
+                        szTableQualifier,
+                        cbTableQualifier,
+                        szTableOwner,
+                        cbTableOwner,
+                        szTableName,
+                        cbTableName,
+                        fUnique,
+                        fAccuracy ) )
 
 #if 0
-       retcode = hproc(pstmt->dhstmt,
-                       szTableQualifier,
-                       cbTableQualifier,
-                       szTableOwner,
-                       cbTableOwner,
-                       szTableName,
-                       cbTableName,
-                       fUnique,
-                       fAccuracy );
+        retcode = hproc(pstmt->dhstmt,
+                        szTableQualifier,
+                        cbTableQualifier,
+                        szTableOwner,
+                        cbTableOwner,
+                        szTableName,
+                        cbTableName,
+                        fUnique,
+                        fAccuracy );
 #endif
 
-       return _iodbcdm_cata_state_tr( hstmt, en_Statistics, retcode );
+        return _iodbcdm_cata_state_tr( hstmt, en_Statistics, retcode );
 }
 
-RETCODE SQL_API        SQLTables(
-                       HSTMT           hstmt, 
-                       UCHAR FAR*      szTableQualifier,
-                       SWORD           cbTableQualifier,
-                       UCHAR FAR*      szTableOwner,
-                       SWORD           cbTableOwner,
-                       UCHAR FAR*      szTableName,
-                       SWORD           cbTableName,
-                       UCHAR FAR*      szTableType,
-                       SWORD           cbTableType )
+RETCODE SQL_API SQLTables(
+                        HSTMT           hstmt,
+                        UCHAR FAR*      szTableQualifier,
+                        SWORD           cbTableQualifier,
+                        UCHAR FAR*      szTableOwner,
+                        SWORD           cbTableOwner,
+                        UCHAR FAR*      szTableName,
+                        SWORD           cbTableName,
+                        UCHAR FAR*      szTableType,
+                        SWORD           cbTableType )
 {
-       STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
-       HPROC           hproc   = SQL_NULL_HPROC;
-       RETCODE         retcode;
-       int             sqlstat = en_00000;
-
-       if( hstmt == SQL_NULL_HSTMT
-        || pstmt->hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       for(;;)
-       {
-               if( ( cbTableQualifier < 0 && cbTableQualifier != SQL_NTS )
-                || ( cbTableOwner     < 0 && cbTableOwner     != SQL_NTS )
-                || ( cbTableName      < 0 && cbTableName      != SQL_NTS ) 
-                || ( cbTableType      < 0 && cbTableType      != SQL_NTS ) )
-               {
-                       sqlstat = en_S1090;
-                       break;
-               }
-
-               retcode = _iodbcdm_cata_state_ok ( hstmt, en_Tables );
-               
-               if( retcode != SQL_SUCCESS )
-               {
-                       return SQL_ERROR;
-               }
-
-               hproc = _iodbcdm_getproc( pstmt->hdbc, en_Tables );
-
-               if( hproc == SQL_NULL_HPROC )
-               {
-                       sqlstat = en_IM001;
-                       break;
-               }
-
-               sqlstat = en_00000;
-
-               if( 1 ) /* turn off solaris warning message */
-                       break;
-       }
-
-       if( sqlstat != en_00000 )
-       {
-               PUSHSQLERR ( pstmt->herr, sqlstat );
-
-               return SQL_ERROR;
-       }
-
-       CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_Tables, (
-                       pstmt->dhstmt,
-                       szTableQualifier,
-                       cbTableQualifier,
-                       szTableOwner,
-                       cbTableOwner,
-                       szTableName,
-                       cbTableName,
-                       szTableType,
-                       cbTableType ) )
-       
+        STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
+        HPROC           hproc;
+        RETCODE         retcode;
+        int             sqlstat = en_00000;
+
+        if( hstmt == SQL_NULL_HSTMT
+         || pstmt->hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        for(;;)
+        {
+                if( ( cbTableQualifier < 0 && cbTableQualifier != SQL_NTS )
+                 || ( cbTableOwner     < 0 && cbTableOwner     != SQL_NTS )
+                 || ( cbTableName      < 0 && cbTableName      != SQL_NTS )
+                 || ( cbTableType      < 0 && cbTableType      != SQL_NTS ) )
+                {
+                        sqlstat = en_S1090;
+                        break;
+                }
+
+                retcode = _iodbcdm_cata_state_ok ( hstmt, en_Tables );
+
+                if( retcode != SQL_SUCCESS )
+                {
+                        return SQL_ERROR;
+                }
+
+                hproc = _iodbcdm_getproc( pstmt->hdbc, en_Tables );
+
+                if( hproc == SQL_NULL_HPROC )
+                {
+                        sqlstat = en_IM001;
+                        break;
+                }
+
+                sqlstat = en_00000;
+
+                if( 1 ) /* turn off solaris warning message */
+                        break;
+        }
+
+        if( sqlstat != en_00000 )
+        {
+                PUSHSQLERR ( pstmt->herr, sqlstat );
+
+                return SQL_ERROR;
+        }
+
+        CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_Tables, (
+                        pstmt->dhstmt,
+                        szTableQualifier,
+                        cbTableQualifier,
+                        szTableOwner,
+                        cbTableOwner,
+                        szTableName,
+                        cbTableName,
+                        szTableType,
+                        cbTableType ) )
+
 #if 0
-       retcode = hproc(pstmt->dhstmt,
-                       szTableQualifier,
-                       cbTableQualifier,
-                       szTableOwner,
-                       cbTableOwner,
-                       szTableName,
-                       cbTableName,
-                       szTableType,
-                       cbTableType );
+        retcode = hproc(pstmt->dhstmt,
+                        szTableQualifier,
+                        cbTableQualifier,
+                        szTableOwner,
+                        cbTableOwner,
+                        szTableName,
+                        cbTableName,
+                        szTableType,
+                        cbTableType );
 #endif
 
-       return _iodbcdm_cata_state_tr( hstmt, en_Tables, retcode );
+        return _iodbcdm_cata_state_tr( hstmt, en_Tables, retcode );
 }
 
 RETCODE SQL_API SQLColumnPrivileges(
-                       HSTMT           hstmt,
-                       UCHAR FAR*      szTableQualifier,
-                       SWORD           cbTableQualifier,
-                       UCHAR FAR*      szTableOwner,
-                       SWORD           cbTableOwner,
-                       UCHAR FAR*      szTableName,
-                       SWORD           cbTableName,
-                       UCHAR FAR*      szColumnName,
-                       SWORD           cbColumnName )
+                        HSTMT           hstmt,
+                        UCHAR FAR*      szTableQualifier,
+                        SWORD           cbTableQualifier,
+                        UCHAR FAR*      szTableOwner,
+                        SWORD           cbTableOwner,
+                        UCHAR FAR*      szTableName,
+                        SWORD           cbTableName,
+                        UCHAR FAR*      szColumnName,
+                        SWORD           cbColumnName )
 {
-       STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
-       HPROC           hproc   = SQL_NULL_HPROC;
-       RETCODE         retcode;
-       int             sqlstat = en_00000;
-
-       if( hstmt == SQL_NULL_HSTMT
-        || pstmt->hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       for(;;)
-       {
-               if( ( cbTableQualifier < 0 && cbTableQualifier != SQL_NTS )
-                || ( cbTableOwner     < 0 && cbTableOwner     != SQL_NTS )
-                || ( cbTableName      < 0 && cbTableName      != SQL_NTS ) 
-                || ( cbColumnName     < 0 && cbColumnName     != SQL_NTS ) )
-               {
-                       sqlstat = en_S1090;
-                       break;
-               }
-
-               retcode = _iodbcdm_cata_state_ok ( hstmt, en_ColumnPrivileges );
-               
-               if( retcode != SQL_SUCCESS )
-               {
-                       return SQL_ERROR;
-               }
-
-               hproc = _iodbcdm_getproc( pstmt->hdbc, en_ColumnPrivileges );
-
-               if( hproc == SQL_NULL_HPROC )
-               {
-                       sqlstat = en_IM001;
-                       break;
-               }
-
-               sqlstat = en_00000;
-
-               if( 1 ) /* turn off solaris warning message */
-                       break;
-       }
-
-       if( sqlstat != en_00000 )
-       {
-               PUSHSQLERR ( pstmt->herr, sqlstat );
-
-               return SQL_ERROR;
-       }
-
-       CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_ColumnPrivileges, (
-                       pstmt->dhstmt,
-                       szTableQualifier,
-                       cbTableQualifier,
-                       szTableOwner,
-                       cbTableOwner,
-                       szTableName,
-                       cbTableName,
-                       szColumnName,
-                       cbColumnName ) )
+        STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
+        HPROC           hproc;
+        RETCODE         retcode;
+        int             sqlstat = en_00000;
+
+        if( hstmt == SQL_NULL_HSTMT
+         || pstmt->hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        for(;;)
+        {
+                if( ( cbTableQualifier < 0 && cbTableQualifier != SQL_NTS )
+                 || ( cbTableOwner     < 0 && cbTableOwner     != SQL_NTS )
+                 || ( cbTableName      < 0 && cbTableName      != SQL_NTS )
+                 || ( cbColumnName     < 0 && cbColumnName     != SQL_NTS ) )
+                {
+                        sqlstat = en_S1090;
+                        break;
+                }
+
+                retcode = _iodbcdm_cata_state_ok ( hstmt, en_ColumnPrivileges );
+
+                if( retcode != SQL_SUCCESS )
+                {
+                        return SQL_ERROR;
+                }
+
+                hproc = _iodbcdm_getproc( pstmt->hdbc, en_ColumnPrivileges );
+
+                if( hproc == SQL_NULL_HPROC )
+                {
+                        sqlstat = en_IM001;
+                        break;
+                }
+
+                sqlstat = en_00000;
+
+                if( 1 ) /* turn off solaris warning message */
+                        break;
+        }
+
+        if( sqlstat != en_00000 )
+        {
+                PUSHSQLERR ( pstmt->herr, sqlstat );
+
+                return SQL_ERROR;
+        }
+
+        CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_ColumnPrivileges, (
+                        pstmt->dhstmt,
+                        szTableQualifier,
+                        cbTableQualifier,
+                        szTableOwner,
+                        cbTableOwner,
+                        szTableName,
+                        cbTableName,
+                        szColumnName,
+                        cbColumnName ) )
 
 #if 0
-       retcode = hproc(pstmt->dhstmt,
-                       szTableQualifier,
-                       cbTableQualifier,
-                       szTableOwner,
-                       cbTableOwner,
-                       szTableName,
-                       cbTableName,
-                       szColumnName,
-                       cbColumnName );
+        retcode = hproc(pstmt->dhstmt,
+                        szTableQualifier,
+                        cbTableQualifier,
+                        szTableOwner,
+                        cbTableOwner,
+                        szTableName,
+                        cbTableName,
+                        szColumnName,
+                        cbColumnName );
 #endif
 
-       return _iodbcdm_cata_state_tr( hstmt, en_ColumnPrivileges, retcode );
+        return _iodbcdm_cata_state_tr( hstmt, en_ColumnPrivileges, retcode );
 }
 
 RETCODE SQL_API SQLColumns(
-                       HSTMT           hstmt,
-                       UCHAR FAR*      szTableQualifier,
-                       SWORD           cbTableQualifier,
-                       UCHAR FAR*      szTableOwner,
-                       SWORD           cbTableOwner, 
-                       UCHAR FAR*      szTableName,
-                       SWORD           cbTableName,
-                       UCHAR FAR*      szColumnName,
-                       SWORD           cbColumnName )
+                        HSTMT           hstmt,
+                        UCHAR FAR*      szTableQualifier,
+                        SWORD           cbTableQualifier,
+                        UCHAR FAR*      szTableOwner,
+                        SWORD           cbTableOwner,
+                        UCHAR FAR*      szTableName,
+                        SWORD           cbTableName,
+                        UCHAR FAR*      szColumnName,
+                        SWORD           cbColumnName )
 {
-       STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
-       HPROC           hproc   = SQL_NULL_HPROC;
-       RETCODE         retcode;
-       int             sqlstat = en_00000;
-
-       if( hstmt == SQL_NULL_HSTMT
-        || pstmt->hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       for(;;)
-       {
-               if( ( cbTableQualifier < 0 && cbTableQualifier != SQL_NTS )
-                || ( cbTableOwner     < 0 && cbTableOwner     != SQL_NTS )
-                || ( cbTableName      < 0 && cbTableName      != SQL_NTS ) 
-                || ( cbColumnName     < 0 && cbColumnName     != SQL_NTS ) )
-               {
-                       sqlstat = en_S1090;
-                       break;
-               }
-
-               retcode = _iodbcdm_cata_state_ok ( hstmt, en_Columns );
-               
-               if( retcode != SQL_SUCCESS )
-               {
-                       return SQL_ERROR;
-               }
-
-               hproc = _iodbcdm_getproc( pstmt->hdbc, en_Columns );
-
-               if( hproc == SQL_NULL_HPROC )
-               {
-                       sqlstat = en_IM001;
-                       break;
-               }
-
-               sqlstat = en_00000;
-
-               if( 1 ) /* turn off solaris warning message */
-                       break;
-       }
-
-       if( sqlstat != en_00000 )
-       {
-               PUSHSQLERR ( pstmt->herr, sqlstat );
-
-               return SQL_ERROR;
-       }
-
-       CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_Columns, (
-                       pstmt->dhstmt,
-                       szTableQualifier,
-                       cbTableQualifier,
-                       szTableOwner,
-                       cbTableOwner,
-                       szTableName,
-                       cbTableName,
-                       szColumnName,
-                       cbColumnName ) )
+        STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
+        HPROC           hproc;
+        RETCODE         retcode;
+        int             sqlstat = en_00000;
+
+        if( hstmt == SQL_NULL_HSTMT
+         || pstmt->hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        for(;;)
+        {
+                if( ( cbTableQualifier < 0 && cbTableQualifier != SQL_NTS )
+                 || ( cbTableOwner     < 0 && cbTableOwner     != SQL_NTS )
+                 || ( cbTableName      < 0 && cbTableName      != SQL_NTS )
+                 || ( cbColumnName     < 0 && cbColumnName     != SQL_NTS ) )
+                {
+                        sqlstat = en_S1090;
+                        break;
+                }
+
+                retcode = _iodbcdm_cata_state_ok ( hstmt, en_Columns );
+
+                if( retcode != SQL_SUCCESS )
+                {
+                        return SQL_ERROR;
+                }
+
+                hproc = _iodbcdm_getproc( pstmt->hdbc, en_Columns );
+
+                if( hproc == SQL_NULL_HPROC )
+                {
+                        sqlstat = en_IM001;
+                        break;
+                }
+
+                sqlstat = en_00000;
+
+                if( 1 ) /* turn off solaris warning message */
+                        break;
+        }
+
+        if( sqlstat != en_00000 )
+        {
+                PUSHSQLERR ( pstmt->herr, sqlstat );
+
+                return SQL_ERROR;
+        }
+
+        CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_Columns, (
+                        pstmt->dhstmt,
+                        szTableQualifier,
+                        cbTableQualifier,
+                        szTableOwner,
+                        cbTableOwner,
+                        szTableName,
+                        cbTableName,
+                        szColumnName,
+                        cbColumnName ) )
 
 #if 0
-       retcode = hproc(pstmt->dhstmt,
-                       szTableQualifier,
-                       cbTableQualifier,
-                       szTableOwner,
-                       cbTableOwner,
-                       szTableName,
-                       cbTableName,
-                       szColumnName,
-                       cbColumnName );
+        retcode = hproc(pstmt->dhstmt,
+                        szTableQualifier,
+                        cbTableQualifier,
+                        szTableOwner,
+                        cbTableOwner,
+                        szTableName,
+                        cbTableName,
+                        szColumnName,
+                        cbColumnName );
 #endif
 
-       return _iodbcdm_cata_state_tr( hstmt, en_Columns, retcode );
+        return _iodbcdm_cata_state_tr( hstmt, en_Columns, retcode );
 }
 
 RETCODE SQL_API SQLForeignKeys(
-                       HSTMT           hstmt,
-                       UCHAR FAR*      szPkTableQualifier,
-                       SWORD           cbPkTableQualifier, 
-                       UCHAR FAR*      szPkTableOwner,
-                       SWORD           cbPkTableOwner,
-                       UCHAR FAR*      szPkTableName,
-                       SWORD           cbPkTableName,
-                       UCHAR FAR*      szFkTableQualifier,
-                       SWORD           cbFkTableQualifier,
-                       UCHAR FAR*      szFkTableOwner,
-                       SWORD           cbFkTableOwner,
-                       UCHAR FAR*      szFkTableName,
-                       SWORD           cbFkTableName )
+                        HSTMT           hstmt,
+                        UCHAR FAR*      szPkTableQualifier,
+                        SWORD           cbPkTableQualifier,
+                        UCHAR FAR*      szPkTableOwner,
+                        SWORD           cbPkTableOwner,
+                        UCHAR FAR*      szPkTableName,
+                        SWORD           cbPkTableName,
+                        UCHAR FAR*      szFkTableQualifier,
+                        SWORD           cbFkTableQualifier,
+                        UCHAR FAR*      szFkTableOwner,
+                        SWORD           cbFkTableOwner,
+                        UCHAR FAR*      szFkTableName,
+                        SWORD           cbFkTableName )
 {
-       STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
-       HPROC           hproc   = SQL_NULL_HPROC;
-       RETCODE         retcode;
-       int             sqlstat = en_00000;
-
-       if( hstmt == SQL_NULL_HSTMT
-        || pstmt->hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       for(;;)
-       {
-               if( ( cbPkTableQualifier < 0 && cbPkTableQualifier != SQL_NTS )
-                || ( cbPkTableOwner     < 0 && cbPkTableOwner     != SQL_NTS )
-                || ( cbPkTableName      < 0 && cbPkTableName      != SQL_NTS ) 
-                || ( cbFkTableQualifier < 0 && cbFkTableQualifier != SQL_NTS )
-                || ( cbFkTableOwner     < 0 && cbFkTableOwner     != SQL_NTS )
-                || ( cbFkTableName      < 0 && cbFkTableName      != SQL_NTS ) )
-               {
-                       sqlstat = en_S1090;
-                       break;
-               }
-
-               retcode = _iodbcdm_cata_state_ok ( hstmt, en_ForeignKeys );
-               
-               if( retcode != SQL_SUCCESS )
-               {
-                       return SQL_ERROR;
-               }
-
-               hproc = _iodbcdm_getproc( pstmt->hdbc, en_ForeignKeys );
-
-               if( hproc == SQL_NULL_HPROC )
-               {
-                       sqlstat = en_IM001;
-                       break;
-               }
-
-               sqlstat = en_00000;
-
-               if( 1 ) /* turn off solaris warning message */
-                       break;
-       }
-
-       if( sqlstat != en_00000 )
-       {
-               PUSHSQLERR ( pstmt->herr, sqlstat );
-
-               return SQL_ERROR;
-       }
-
-       CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_ForeignKeys, (
-                       pstmt->dhstmt,
-                       szPkTableQualifier,
-                       cbPkTableQualifier,
-                       szPkTableOwner,
-                       cbPkTableOwner,
-                       szPkTableName,
-                       cbPkTableName,
-                       szFkTableQualifier,
-                       cbFkTableQualifier,
-                       szFkTableOwner,
-                       cbFkTableOwner,
-                       szFkTableName,
-                       cbFkTableName ) )
+        STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
+        HPROC           hproc;
+        RETCODE         retcode;
+        int             sqlstat = en_00000;
+
+        if( hstmt == SQL_NULL_HSTMT
+         || pstmt->hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        for(;;)
+        {
+                if( ( cbPkTableQualifier < 0 && cbPkTableQualifier != SQL_NTS )
+                 || ( cbPkTableOwner     < 0 && cbPkTableOwner     != SQL_NTS )
+                 || ( cbPkTableName      < 0 && cbPkTableName      != SQL_NTS )
+                 || ( cbFkTableQualifier < 0 && cbFkTableQualifier != SQL_NTS )
+                 || ( cbFkTableOwner     < 0 && cbFkTableOwner     != SQL_NTS )
+                 || ( cbFkTableName      < 0 && cbFkTableName      != SQL_NTS ) )
+                {
+                        sqlstat = en_S1090;
+                        break;
+                }
+
+                retcode = _iodbcdm_cata_state_ok ( hstmt, en_ForeignKeys );
+
+                if( retcode != SQL_SUCCESS )
+                {
+                        return SQL_ERROR;
+                }
+
+                hproc = _iodbcdm_getproc( pstmt->hdbc, en_ForeignKeys );
+
+                if( hproc == SQL_NULL_HPROC )
+                {
+                        sqlstat = en_IM001;
+                        break;
+                }
+
+                sqlstat = en_00000;
+
+                if( 1 ) /* turn off solaris warning message */
+                        break;
+        }
+
+        if( sqlstat != en_00000 )
+        {
+                PUSHSQLERR ( pstmt->herr, sqlstat );
+
+                return SQL_ERROR;
+        }
+
+        CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_ForeignKeys, (
+                        pstmt->dhstmt,
+                        szPkTableQualifier,
+                        cbPkTableQualifier,
+                        szPkTableOwner,
+                        cbPkTableOwner,
+                        szPkTableName,
+                        cbPkTableName,
+                        szFkTableQualifier,
+                        cbFkTableQualifier,
+                        szFkTableOwner,
+                        cbFkTableOwner,
+                        szFkTableName,
+                        cbFkTableName ) )
 
 #if 0
-       retcode = hproc(pstmt->dhstmt,
-                       szPkTableQualifier,
-                       cbPkTableQualifier,
-                       szPkTableOwner,
-                       cbPkTableOwner,
-                       szPkTableName,
-                       cbPkTableName,
-                       szFkTableQualifier,
-                       cbFkTableQualifier,
-                       szFkTableOwner,
-                       cbFkTableOwner,
-                       szFkTableName,
-                       cbFkTableName );
+        retcode = hproc(pstmt->dhstmt,
+                        szPkTableQualifier,
+                        cbPkTableQualifier,
+                        szPkTableOwner,
+                        cbPkTableOwner,
+                        szPkTableName,
+                        cbPkTableName,
+                        szFkTableQualifier,
+                        cbFkTableQualifier,
+                        szFkTableOwner,
+                        cbFkTableOwner,
+                        szFkTableName,
+                        cbFkTableName );
 #endif
 
-       return _iodbcdm_cata_state_tr( hstmt, en_ForeignKeys, retcode );
+        return _iodbcdm_cata_state_tr( hstmt, en_ForeignKeys, retcode );
 }
 
 RETCODE SQL_API SQLPrimaryKeys(
-                       HSTMT           hstmt,
-                       UCHAR FAR*      szTableQualifier,
-                       SWORD           cbTableQualifier,
-                       UCHAR FAR*      szTableOwner,
-                       SWORD           cbTableOwner,
-                       UCHAR FAR*      szTableName, 
-                       SWORD           cbTableName )
+                        HSTMT           hstmt,
+                        UCHAR FAR*      szTableQualifier,
+                        SWORD           cbTableQualifier,
+                        UCHAR FAR*      szTableOwner,
+                        SWORD           cbTableOwner,
+                        UCHAR FAR*      szTableName,
+                        SWORD           cbTableName )
 {
-       STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
-       HPROC           hproc   = SQL_NULL_HPROC;
-       RETCODE         retcode;
-       int             sqlstat = en_00000;
-
-       if( hstmt == SQL_NULL_HSTMT
-        || pstmt->hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       for(;;)
-       {
-               if( ( cbTableQualifier < 0 && cbTableQualifier != SQL_NTS )
-                || ( cbTableOwner     < 0 && cbTableOwner     != SQL_NTS )
-                || ( cbTableName      < 0 && cbTableName      != SQL_NTS ) )
-               {
-                       sqlstat = en_S1090;
-                       break;
-               }
-
-               retcode = _iodbcdm_cata_state_ok ( hstmt, en_PrimaryKeys );
-               
-               if( retcode != SQL_SUCCESS )
-               {
-                       return SQL_ERROR;
-               }
-
-               hproc = _iodbcdm_getproc( pstmt->hdbc, en_PrimaryKeys );
-
-               if( hproc == SQL_NULL_HPROC )
-               {
-                       sqlstat = en_IM001;
-                       break;
-               }
-
-               sqlstat = en_00000;
-
-               if( 1 ) /* turn off solaris warning message */
-                       break;
-       }
-
-       if( sqlstat != en_00000 )
-       {
-               PUSHSQLERR ( pstmt->herr, sqlstat );
-
-               return SQL_ERROR;
-       }
-
-       CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_PrimaryKeys, (
-                       pstmt->dhstmt,
-                       szTableQualifier,
-                       cbTableQualifier,
-                       szTableOwner,
-                       cbTableOwner,
-                       szTableName,
-                       cbTableName ) )
-
-#if 0 
-       retcode = hproc(pstmt->dhstmt,
-                       szTableQualifier,
-                       cbTableQualifier,
-                       szTableOwner,
-                       cbTableOwner,
-                       szTableName,
-                       cbTableName );
+        STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
+        HPROC           hproc;
+        RETCODE         retcode;
+        int             sqlstat = en_00000;
+
+        if( hstmt == SQL_NULL_HSTMT
+         || pstmt->hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        for(;;)
+        {
+                if( ( cbTableQualifier < 0 && cbTableQualifier != SQL_NTS )
+                 || ( cbTableOwner     < 0 && cbTableOwner     != SQL_NTS )
+                 || ( cbTableName      < 0 && cbTableName      != SQL_NTS ) )
+                {
+                        sqlstat = en_S1090;
+                        break;
+                }
+
+                retcode = _iodbcdm_cata_state_ok ( hstmt, en_PrimaryKeys );
+
+                if( retcode != SQL_SUCCESS )
+                {
+                        return SQL_ERROR;
+                }
+
+                hproc = _iodbcdm_getproc( pstmt->hdbc, en_PrimaryKeys );
+
+                if( hproc == SQL_NULL_HPROC )
+                {
+                        sqlstat = en_IM001;
+                        break;
+                }
+
+                sqlstat = en_00000;
+
+                if( 1 ) /* turn off solaris warning message */
+                        break;
+        }
+
+        if( sqlstat != en_00000 )
+        {
+                PUSHSQLERR ( pstmt->herr, sqlstat );
+
+                return SQL_ERROR;
+        }
+
+        CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_PrimaryKeys, (
+                        pstmt->dhstmt,
+                        szTableQualifier,
+                        cbTableQualifier,
+                        szTableOwner,
+                        cbTableOwner,
+                        szTableName,
+                        cbTableName ) )
+
+#if 0
+        retcode = hproc(pstmt->dhstmt,
+                        szTableQualifier,
+                        cbTableQualifier,
+                        szTableOwner,
+                        cbTableOwner,
+                        szTableName,
+                        cbTableName );
 #endif
 
-       return _iodbcdm_cata_state_tr( hstmt, en_PrimaryKeys, retcode );
+        return _iodbcdm_cata_state_tr( hstmt, en_PrimaryKeys, retcode );
 }
 
 RETCODE SQL_API SQLProcedureColumns(
-                       HSTMT           hstmt,
-                       UCHAR FAR*      szProcQualifier,
-                       SWORD           cbProcQualifier, 
-                       UCHAR FAR*      szProcOwner,
-                       SWORD           cbProcOwner,
-                       UCHAR FAR*      szProcName,
-                       SWORD           cbProcName,
-                       UCHAR FAR*      szColumnName,
-                       SWORD           cbColumnName )
+                        HSTMT           hstmt,
+                        UCHAR FAR*      szProcQualifier,
+                        SWORD           cbProcQualifier,
+                        UCHAR FAR*      szProcOwner,
+                        SWORD           cbProcOwner,
+                        UCHAR FAR*      szProcName,
+                        SWORD           cbProcName,
+                        UCHAR FAR*      szColumnName,
+                        SWORD           cbColumnName )
 {
-       STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
-       HPROC           hproc   = SQL_NULL_HPROC;
-       RETCODE         retcode;
-       int             sqlstat = en_00000;
-
-       if( hstmt == SQL_NULL_HSTMT
-        || pstmt->hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       for(;;)
-       {
-               if( ( cbProcQualifier < 0 && cbProcQualifier != SQL_NTS )
-                || ( cbProcOwner     < 0 && cbProcOwner     != SQL_NTS )
-                || ( cbProcName      < 0 && cbProcName      != SQL_NTS ) 
-                || ( cbColumnName    < 0 && cbColumnName    != SQL_NTS ) )
-               {
-                       sqlstat = en_S1090;
-                       break;
-               }
-
-               retcode = _iodbcdm_cata_state_ok ( hstmt, en_ProcedureColumns );
-               
-               if( retcode != SQL_SUCCESS )
-               {
-                       return SQL_ERROR;
-               }
-
-               hproc = _iodbcdm_getproc( pstmt->hdbc, en_ProcedureColumns );
-
-               if( hproc == SQL_NULL_HPROC )
-               {
-                       sqlstat = en_IM001;
-                       break;
-               }
-
-               sqlstat = en_00000;
-
-               if( 1 ) /* turn off solaris warning message */
-                       break;
-       }
-
-       if( sqlstat != en_00000 )
-       {
-               PUSHSQLERR ( pstmt->herr, sqlstat );
-
-               return SQL_ERROR;
-       }
-
-       CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_ProcedureColumns, (
-                       pstmt->dhstmt,
-                       szProcQualifier,
-                       cbProcQualifier,
-                       szProcOwner,
-                       cbProcOwner,
-                       szProcName,
-                       cbProcName,
-                       szColumnName,
-                       cbColumnName ) )
+        STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
+        HPROC           hproc;
+        RETCODE         retcode;
+        int             sqlstat = en_00000;
+
+        if( hstmt == SQL_NULL_HSTMT
+         || pstmt->hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        for(;;)
+        {
+                if( ( cbProcQualifier < 0 && cbProcQualifier != SQL_NTS )
+                 || ( cbProcOwner     < 0 && cbProcOwner     != SQL_NTS )
+                 || ( cbProcName      < 0 && cbProcName      != SQL_NTS )
+                 || ( cbColumnName    < 0 && cbColumnName    != SQL_NTS ) )
+                {
+                        sqlstat = en_S1090;
+                        break;
+                }
+
+                retcode = _iodbcdm_cata_state_ok ( hstmt, en_ProcedureColumns );
+
+                if( retcode != SQL_SUCCESS )
+                {
+                        return SQL_ERROR;
+                }
+
+                hproc = _iodbcdm_getproc( pstmt->hdbc, en_ProcedureColumns );
+
+                if( hproc == SQL_NULL_HPROC )
+                {
+                        sqlstat = en_IM001;
+                        break;
+                }
+
+                sqlstat = en_00000;
+
+                if( 1 ) /* turn off solaris warning message */
+                        break;
+        }
+
+        if( sqlstat != en_00000 )
+        {
+                PUSHSQLERR ( pstmt->herr, sqlstat );
+
+                return SQL_ERROR;
+        }
+
+        CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_ProcedureColumns, (
+                        pstmt->dhstmt,
+                        szProcQualifier,
+                        cbProcQualifier,
+                        szProcOwner,
+                        cbProcOwner,
+                        szProcName,
+                        cbProcName,
+                        szColumnName,
+                        cbColumnName ) )
 
 #if 0
-       retcode = hproc(pstmt->dhstmt,
-                       szProcQualifier,
-                       cbProcQualifier,
-                       szProcOwner,
-                       cbProcOwner,
-                       szProcName,
-                       cbProcName,
-                       szColumnName,
-                       cbColumnName );
+        retcode = hproc(pstmt->dhstmt,
+                        szProcQualifier,
+                        cbProcQualifier,
+                        szProcOwner,
+                        cbProcOwner,
+                        szProcName,
+                        cbProcName,
+                        szColumnName,
+                        cbColumnName );
 #endif
 
-       return _iodbcdm_cata_state_tr( hstmt, en_ProcedureColumns, retcode );
+        return _iodbcdm_cata_state_tr( hstmt, en_ProcedureColumns, retcode );
 }
 
-RETCODE SQL_API SQLProcedures( 
-                       HSTMT           hstmt,
-                       UCHAR FAR*      szProcQualifier,
-                       SWORD           cbProcQualifier,
-                       UCHAR FAR*      szProcOwner,
-                       SWORD           cbProcOwner,
-                       UCHAR FAR*      szProcName,
-                       SWORD           cbProcName )
+RETCODE SQL_API SQLProcedures(
+                        HSTMT           hstmt,
+                        UCHAR FAR*      szProcQualifier,
+                        SWORD           cbProcQualifier,
+                        UCHAR FAR*      szProcOwner,
+                        SWORD           cbProcOwner,
+                        UCHAR FAR*      szProcName,
+                        SWORD           cbProcName )
 {
-       STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
-       HPROC           hproc   = SQL_NULL_HPROC;
-       RETCODE         retcode;
-       int             sqlstat = en_00000;
-
-       if( hstmt == SQL_NULL_HSTMT
-        || pstmt->hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       for(;;)
-       {
-               if( ( cbProcQualifier < 0 && cbProcQualifier != SQL_NTS )
-                || ( cbProcOwner     < 0 && cbProcOwner     != SQL_NTS )
-                || ( cbProcName      < 0 && cbProcName      != SQL_NTS ) )
-               {
-                       sqlstat = en_S1090;
-                       break;
-               }
-
-               retcode = _iodbcdm_cata_state_ok ( hstmt, en_Procedures );
-               
-               if( retcode != SQL_SUCCESS )
-               {
-                       return SQL_ERROR;
-               }
-
-               hproc = _iodbcdm_getproc( pstmt->hdbc, en_Procedures );
-
-               if( hproc == SQL_NULL_HPROC )
-               {
-                       sqlstat = en_IM001;
-                       break;
-               }
-
-               sqlstat = en_00000;
-
-               if( 1 ) /* turn off solaris warning message */
-                       break;
-       }
-
-       if( sqlstat != en_00000 )
-       {
-               PUSHSQLERR ( pstmt->herr, sqlstat );
-
-               return SQL_ERROR;
-       }
-
-       CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_Procedures, (
-                       pstmt->dhstmt,
-                       szProcQualifier,
-                       cbProcQualifier,
-                       szProcOwner,
-                       cbProcOwner,
-                       szProcName,
-                       cbProcName ) )
-
-#if 0  
-       retcode = hproc(pstmt->dhstmt,
-                       szProcQualifier,
-                       cbProcQualifier,
-                       szProcOwner,
-                       cbProcOwner,
-                       szProcName,
-                       cbProcName );
+        STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
+        HPROC           hproc;
+        RETCODE         retcode;
+        int             sqlstat = en_00000;
+
+        if( hstmt == SQL_NULL_HSTMT
+         || pstmt->hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        for(;;)
+        {
+                if( ( cbProcQualifier < 0 && cbProcQualifier != SQL_NTS )
+                 || ( cbProcOwner     < 0 && cbProcOwner     != SQL_NTS )
+                 || ( cbProcName      < 0 && cbProcName      != SQL_NTS ) )
+                {
+                        sqlstat = en_S1090;
+                        break;
+                }
+
+                retcode = _iodbcdm_cata_state_ok ( hstmt, en_Procedures );
+
+                if( retcode != SQL_SUCCESS )
+                {
+                        return SQL_ERROR;
+                }
+
+                hproc = _iodbcdm_getproc( pstmt->hdbc, en_Procedures );
+
+                if( hproc == SQL_NULL_HPROC )
+                {
+                        sqlstat = en_IM001;
+                        break;
+                }
+
+                sqlstat = en_00000;
+
+                if( 1 ) /* turn off solaris warning message */
+                        break;
+        }
+
+        if( sqlstat != en_00000 )
+        {
+                PUSHSQLERR ( pstmt->herr, sqlstat );
+
+                return SQL_ERROR;
+        }
+
+        CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_Procedures, (
+                        pstmt->dhstmt,
+                        szProcQualifier,
+                        cbProcQualifier,
+                        szProcOwner,
+                        cbProcOwner,
+                        szProcName,
+                        cbProcName ) )
+
+#if 0
+        retcode = hproc(pstmt->dhstmt,
+                        szProcQualifier,
+                        cbProcQualifier,
+                        szProcOwner,
+                        cbProcOwner,
+                        szProcName,
+                        cbProcName );
 #endif
 
-       return _iodbcdm_cata_state_tr( hstmt, en_Procedures, retcode );
+        return _iodbcdm_cata_state_tr( hstmt, en_Procedures, retcode );
 }
 
 RETCODE SQL_API SQLTablePrivileges(
-                       HSTMT           hstmt,
-                       UCHAR FAR*      szTableQualifier,
-                       SWORD           cbTableQualifier,
-                       UCHAR FAR*      szTableOwner,
-                       SWORD           cbTableOwner,
-                       UCHAR FAR*      szTableName,
-                       SWORD           cbTableName )
+                        HSTMT           hstmt,
+                        UCHAR FAR*      szTableQualifier,
+                        SWORD           cbTableQualifier,
+                        UCHAR FAR*      szTableOwner,
+                        SWORD           cbTableOwner,
+                        UCHAR FAR*      szTableName,
+                        SWORD           cbTableName )
 {
 
-       STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
-       HPROC           hproc   = SQL_NULL_HPROC;
-       RETCODE         retcode;
-       int             sqlstat = en_00000;
-
-       if( hstmt == SQL_NULL_HSTMT
-        || pstmt->hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       for(;;)
-       {
-               if( ( cbTableQualifier < 0 && cbTableQualifier != SQL_NTS )
-                || ( cbTableOwner     < 0 && cbTableOwner     != SQL_NTS )
-                || ( cbTableName      < 0 && cbTableName      != SQL_NTS ) )
-               {
-                       sqlstat = en_S1090;
-                       break;
-               }
-
-               retcode = _iodbcdm_cata_state_ok ( hstmt, en_TablePrivileges );
-               
-               if( retcode != SQL_SUCCESS )
-               {
-                       return SQL_ERROR;
-               }
-
-               hproc = _iodbcdm_getproc( pstmt->hdbc, en_TablePrivileges );
-
-               if( hproc == SQL_NULL_HPROC )
-               {
-                       sqlstat = en_IM001;
-                       break;
-               }
-
-               sqlstat = en_00000;
-
-               if( 1 ) /* turn off solaris warning message */
-                       break;
-       }
-
-       if( sqlstat != en_00000 )
-       {
-               PUSHSQLERR ( pstmt->herr, sqlstat );
-
-               return SQL_ERROR;
-       }
-
-       CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_TablePrivileges, (
-                       pstmt->dhstmt,
-                       szTableQualifier,
-                       cbTableQualifier,
-                       szTableOwner,
-                       cbTableOwner,
-                       szTableName,
-                       cbTableName ) )
+        STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
+        HPROC           hproc;
+        RETCODE         retcode;
+        int             sqlstat = en_00000;
+
+        if( hstmt == SQL_NULL_HSTMT
+         || pstmt->hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        for(;;)
+        {
+                if( ( cbTableQualifier < 0 && cbTableQualifier != SQL_NTS )
+                 || ( cbTableOwner     < 0 && cbTableOwner     != SQL_NTS )
+                 || ( cbTableName      < 0 && cbTableName      != SQL_NTS ) )
+                {
+                        sqlstat = en_S1090;
+                        break;
+                }
+
+                retcode = _iodbcdm_cata_state_ok ( hstmt, en_TablePrivileges );
+
+                if( retcode != SQL_SUCCESS )
+                {
+                        return SQL_ERROR;
+                }
+
+                hproc = _iodbcdm_getproc( pstmt->hdbc, en_TablePrivileges );
+
+                if( hproc == SQL_NULL_HPROC )
+                {
+                        sqlstat = en_IM001;
+                        break;
+                }
+
+                sqlstat = en_00000;
+
+                if( 1 ) /* turn off solaris warning message */
+                        break;
+        }
+
+        if( sqlstat != en_00000 )
+        {
+                PUSHSQLERR ( pstmt->herr, sqlstat );
+
+                return SQL_ERROR;
+        }
+
+        CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_TablePrivileges, (
+                        pstmt->dhstmt,
+                        szTableQualifier,
+                        cbTableQualifier,
+                        szTableOwner,
+                        cbTableOwner,
+                        szTableName,
+                        cbTableName ) )
 
 #if 0
-       retcode = hproc(pstmt->dhstmt,
-                       szTableQualifier,
-                       cbTableQualifier,
-                       szTableOwner,
-                       cbTableOwner,
-                       szTableName,
-                       cbTableName );
+        retcode = hproc(pstmt->dhstmt,
+                        szTableQualifier,
+                        cbTableQualifier,
+                        szTableOwner,
+                        cbTableOwner,
+                        szTableName,
+                        cbTableName );
 #endif
 
-       return _iodbcdm_cata_state_tr( hstmt, en_TablePrivileges, retcode );
+        return _iodbcdm_cata_state_tr( hstmt, en_TablePrivileges, retcode );
 }
index 7883fb87bef124af11dec926f7f9382e5f956784..e4319509a831914230b38c97a9e65b5fa21b8379 100644 (file)
-#ifndef _LINUX_CONFIG_H
-#define _LINUX_CONFIG_H
+#ifndef _CONFIG_H
+#define _CONFIG_H
 
-#ifdef __LINUX__
-#include <linux/autoconf.h>
-#endif
+# if    !defined(WINDOWS) && !defined(WIN32_SYSTEM) && !defined(OS2)
+#  define       _UNIX_
 
-/*
- * Defines for what uname() should return 
- */
-#ifndef UTS_SYSNAME
-#define UTS_SYSNAME "Linux"
-#endif
+#  include      <stdlib.h>
+#  include      <sys/types.h>
+#  include      <string.h>
+#  include      <stdio.h>
 
-#ifndef UTS_MACHINE
-#define UTS_MACHINE "unknown"
-#endif
+#  define       MEM_ALLOC(size) (malloc((size_t)(size)))
+#  define       MEM_FREE(ptr)   {if(ptr) free(ptr);}
 
-#ifndef UTS_NODENAME
-#define UTS_NODENAME "(none)"  /* set by sethostname() */
-#endif
+#  define       STRCPY(t, s)    (strcpy((char*)(t), (char*)(s)))
+#  define       STRNCPY(t,s,n)  (strncpy((char*)(t), (char*)(s), (size_t)(n)))
+#  define       STRCAT(t, s)    (strcat((char*)(t), (char*)(s)))
+#  define       STRNCAT(t,s,n)  (strncat((char*)(t), (char*)(s), (size_t)(n)))
+#  define       STREQ(a, b)     (strcmp((char*)(a), (char*)(b)) == 0)
+#  define       STRLEN(str)     ((str)? strlen((char*)(str)):0)
 
-#ifndef UTS_DOMAINNAME
-#define UTS_DOMAINNAME "(none)"        /* set by setdomainname() */
-#endif
+#  define       EXPORT
+#  define       CALLBACK
+#  define       FAR
+
+   typedef      signed short    SSHOR;
+   typedef      short           WORD;
+   typedef      long            DWORD;
+
+   typedef      WORD            WPARAM;
+   typedef      DWORD           LPARAM;
+   typedef      void*           HWND;
+   typedef      int             BOOL;
+
+# endif /* _UNIX_ */
+
+# if    defined(WINDOWS) || defined(WIN32_SYSTEM)
+
+#  include      <windows.h>
+#  include      <windowsx.h>
+
+#  ifdef        _MSVC_
+#   define      MEM_ALLOC(size) (fmalloc((size_t)(size)))
+#   define      MEM_FREE(ptr)   ((ptr)? ffree((PTR)(ptr)):0))
+#   define      STRCPY(t, s)    (fstrcpy((char FAR*)(t), (char FAR*)(s)))
+#   define      STRNCPY(t,s,n)  (fstrncpy((char FAR*)(t), (char FAR*)(s), (size_t)(n)))
+#   define      STRLEN(str)     ((str)? fstrlen((char FAR*)(str)):0)
+#   define      STREQ(a, b)     (fstrcmp((char FAR*)(a), (char FAR*)(b) == 0)
+#  endif
+
+#  ifdef        _BORLAND_
+#   define      MEM_ALLOC(size) (farmalloc((unsigned long)(size))
+#   define      MEM_FREE(ptr)   ((ptr)? farfree((void far*)(ptr)):0)
+#   define      STRCPY(t, s)    (_fstrcpy((char FAR*)(t), (char FAR*)(s)))
+#   define      STRNCPY(t,s,n)  (_fstrncpy((char FAR*)(t), (char FAR*)(s), (size_t)(n)))
+#   define      STRLEN(str)     ((str)? _fstrlen((char FAR*)(str)):0)
+#   define      STREQ(a, b)     (_fstrcmp((char FAR*)(a), (char FAR*)(b) == 0)
+#  endif
+
+# endif /* WINDOWS */
+
+# if    defined(OS2)
+
+#  include      <stdlib.h>
+#  include      <stdio.h>
+#  include      <string.h>
+#  include      <memory.h>
+#  define INCL_DOSMODULEMGR                 /* Module Manager values */
+#  define INCL_DOSERRORS                    /* Error values          */
+#  include      <os2.h>
+
+#  ifndef FAR
+#    define     FAR
+#  endif
+
+#  define       MEM_ALLOC(size) (malloc((size_t)(size)))
+#  define       MEM_FREE(ptr)   (free((ptr)))
+#  define       STRCPY(t, s)    (strcpy((char*)(t), (char*)(s)))
+#  define       STRNCPY(t,s,n)  (strncpy((char*)(t), (char*)(s), (size_t)(n)))
+#  define       STRCAT(t, s)    (strcat((char*)(t), (char*)(s)))
+#  define       STRNCAT(t,s,n)  (strncat((char*)(t), (char*)(s), (size_t)(n)))
+#  define       STRLEN(str)     ((str)? strlen((char*)(str)):0)
+#  define       STREQ(a, b)     (0 == strcmp((char *)(a), (char *)(b)))
+
+   typedef      signed short    SSHOR;
+   typedef      short           WORD;
+   typedef      long            DWORD;
 
-/*
- * The definitions for UTS_RELEASE and UTS_VERSION are now defined
- * in linux/version.h, and should only be used by linux/version.c
- */
+   typedef      WORD            WPARAM;
+   typedef      DWORD           LPARAM;
 
-/* Shouldn't these be defined somewhere in a i386 definition? */
+# endif /* OS2 */
 
-/* Don't touch these, unless you really know what you're doing. */
-#define DEF_INITSEG    0x9000
-#define DEF_SYSSEG     0x1000
-#define DEF_SETUPSEG   0x9020
-#define DEF_SYSSIZE    0x7F00
+# define        SYSERR          (-1)
 
-/* internal svga startup constants */
-#define NORMAL_VGA     0xffff          /* 80x25 mode */
-#define EXTENDED_VGA   0xfffe          /* 80x50 mode */
-#define ASK_VGA                0xfffd          /* ask for it at bootup */
+# ifndef        NULL
+#   define      NULL            ((void FAR*)0UL)
+# endif
 
 #endif
index 88e636aca797981b25cac11b88e15a4639abe3e3..11a5bbd0c9a79568995ad76c7e9fa9ad81d4dff6 100644 (file)
@@ -1,6 +1,6 @@
 /** Connect(load) driver
 
-    Copyright (C) 1995 by Ke Jin <kejin@empress.com> 
+    Copyright (C) 1995 by Ke Jin <kejin@empress.com>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 #include       <../iodbc/hstmt.h>
 
 #include       <../iodbc/itrace.h>
+
 #include        <strings.h>
 #include        <stdio.h>
 
-extern char*   _iodbcdm_getkeyvalbydsn();
-extern char*   _iodbcdm_getkeyvalinstr();
-extern RETCODE _iodbcdm_driverunload();
+extern  char*   _iodbcdm_getkeyvalbydsn();
+extern  char*   _iodbcdm_getkeyvalinstr();
+extern  RETCODE _iodbcdm_driverunload();
 
 /*
- *   Following id string is a copyright mark. Removing(i.e. use 
- *   souce code of this package without it or make it not appear 
- *   in the final object file) or modifing it without permission 
- *   from original author(kejin@empress.com) are copyright 
+ *   Following id string is a copyright mark. Removing(i.e. use
+ *   souce code of this package without it or make it not appear
+ *   in the final object file) or modifing it without permission
+ *   from original author(kejin@empress.com) are copyright
  *   violation.
  */
-static char sccsid[] 
-       = "@(#)iODBC driver manager " "2.12" ", Copyright(c) 1995 by Ke Jin";
+static  char sccsid[]
+        = "@(#)iODBC driver manager " "2.12" ", Copyright(c) 1995 by Ke Jin";
 
-static RETCODE _iodbcdm_driverload( 
-                       char FAR*       path,   
-                       HDBC            hdbc )
-/* - Load driver share library( or increase its reference count 
+static RETCODE  _iodbcdm_driverload(
+                        char FAR*       path,
+                        HDBC            hdbc )
+/* - Load driver share library( or increase its reference count
  *   if it has already been loaded by another active connection)
  * - Call driver's SQLAllocEnv() (for the first reference only)
  * - Call driver's SQLAllocConnect()
@@ -54,232 +55,242 @@ static RETCODE    _iodbcdm_driverload(
  * - Increase the bookkeeping reference count
  */
 {
-       DBC_t  FAR*     pdbc = (DBC_t FAR*)hdbc;
-       GENV_t FAR*     genv; 
-       ENV_t  FAR*     penv = NULL;
-       HDLL            hdll;
-       HPROC           hproc;
-       RETCODE         retcode = SQL_SUCCESS;
-       int             sqlstat = en_00000;
-
-       if( path == NULL || path[0] == '\0' )
-       {
-               PUSHSQLERR ( pdbc->herr, en_IM002 );
-
-               return SQL_ERROR;
-       }
-
-       if( hdbc == SQL_NULL_HDBC 
-        || pdbc->genv == SQL_NULL_HENV )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       genv = (GENV_t FAR*)pdbc->genv;
-
-       hdll = _iodbcdm_dllopen( (char FAR*) path ); 
-                                /* This will either load the
-                                 * driver dll or increase its
-                                 * reference count */
-
-       if( hdll == SQL_NULL_HDLL )
-       {
-               PUSHSYSERR ( pdbc->herr, _iodbcdm_dllerror() );
-               PUSHSQLERR ( pdbc->herr, en_IM003 );
-               return SQL_ERROR;
-       }
-
-       penv = (ENV_t FAR*)(pdbc->henv);
-
-       if( penv != NULL )
-       {
-               if( penv->hdll != hdll )
-               {
-                       _iodbcdm_driverunload(hdbc);
-               }
-               else
-               {
-                       _iodbcdm_dllclose( hdll );
-                       /* this will not unload the driver
-                        * but only decrease its internal
-                        * reference count 
-                        */
-               }
-       }
-
-       if(penv == NULL )
-       {
-               /* find out whether this dll has already 
-                * been loaded on another connection */
-               for( penv  = (ENV_t FAR*)genv->henv;
-                    penv != NULL; 
-                    penv  = (ENV_t FAR*)penv->next )
-               {
-                       if( penv->hdll == hdll )
-                       {
-                               _iodbcdm_dllclose( hdll );
-                               /* this will not unload the driver
-                                * but only decrease its internal
-                                * reference count 
-                                */
-                               break;
-                       }
-               }
-       
-               if( penv == NULL )
-               /* no connection attaching with this dll */
-               {
-                       int     i;
-       
-                       /* create a new dll env instance */
-                       penv = (ENV_t FAR*)MEM_ALLOC ( sizeof(ENV_t) );
-       
-                       if( penv == NULL )
-                       {
-                               _iodbcdm_dllclose(hdll); 
-       
-                               PUSHSQLERR ( pdbc->herr, en_S1001 );
-       
-                               return SQL_ERROR;
-                       }
-       
-                       for( i = 0; i< SQL_EXT_API_LAST + 1; i++)
-                       {
-                               (penv->dllproc_tab)[i] = SQL_NULL_HPROC;
-                       }
-       
-                       pdbc->henv = penv;
-                       penv->hdll = hdll;
-       
-                       /* call driver's SQLAllocHandle() or SQLAllocEnv() */
+        DBC_t  FAR*     pdbc = (DBC_t FAR*)hdbc;
+        GENV_t FAR*     genv;
+        ENV_t  FAR*     penv = NULL;
+        HDLL            hdll;
+        HPROC           hproc;
+        RETCODE         retcode = SQL_SUCCESS;
+        int             sqlstat = en_00000;
+
+       if(pdbc->trace)
+       {
+         fprintf(pdbc->tstm, "_iodbcdm_driverload(%s, 0x%x)\n", path, (int)hdbc);
+       }
+
+        if( path == NULL || path[0] == '\0' )
+        {
+                PUSHSQLERR ( pdbc->herr, en_IM002 );
+
+                return SQL_ERROR;
+        }
+
+        if( hdbc == SQL_NULL_HDBC
+         || pdbc->genv == SQL_NULL_HENV )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        genv = (GENV_t FAR*)pdbc->genv;
+
+        hdll = _iodbcdm_dllopen( (char FAR*) path );
+                                 /* This will either load the
+                                  * driver dll or increase its
+                                  * reference count */
+
+        if( hdll == SQL_NULL_HDLL )
+        {
+         if(pdbc->trace)
+         {
+           fprintf(pdbc->tstm, "ERROR: _iodbcdm_driverload cannot load driver - '%s'\n", _iodbcdm_dllerror());
+         }
+
+                PUSHSYSERR ( pdbc->herr, _iodbcdm_dllerror() );
+                PUSHSQLERR ( pdbc->herr, en_IM003 );
+                return SQL_ERROR;
+        }
+
+        penv = (ENV_t FAR*)(pdbc->henv);
+
+        if( penv != NULL )
+        {
+                if( penv->hdll != hdll )
+                {
+                        _iodbcdm_driverunload(hdbc);
+                }
+                else
+                {
+                        _iodbcdm_dllclose( hdll );
+                        /* this will not unload the driver
+                         * but only decrease its internal
+                         * reference count
+                         */
+                }
+        }
+
+        if(penv == NULL )
+        {
+                /* find out whether this dll has already
+                 * been loaded on another connection */
+                for( penv  = (ENV_t FAR*)genv->henv;
+                     penv != NULL;
+                     penv  = (ENV_t FAR*)penv->next )
+                {
+                        if( penv->hdll == hdll )
+                        {
+                                _iodbcdm_dllclose( hdll );
+                                /* this will not unload the driver
+                                 * but only decrease its internal
+                                 * reference count
+                                 */
+                                break;
+                        }
+                }
+
+                if( penv == NULL )
+                /* no connection attaching with this dll */
+                {
+                        int     i;
+
+                        /* create a new dll env instance */
+                        penv = (ENV_t FAR*)MEM_ALLOC ( sizeof(ENV_t) );
+
+                        if( penv == NULL )
+                        {
+                                _iodbcdm_dllclose(hdll);
+
+                                PUSHSQLERR ( pdbc->herr, en_S1001 );
+
+                                return SQL_ERROR;
+                        }
+
+                        for( i = 0; i< SQL_EXT_API_LAST + 1; i++)
+                        {
+                                (penv->dllproc_tab)[i] = SQL_NULL_HPROC;
+                        }
+
+                        pdbc->henv = penv;
+                        penv->hdll = hdll;
+
+                        /* call driver's SQLAllocHandle() or SQLAllocEnv() */
 #if (ODBCVER >= 0x0300)
-                       hproc = _iodbcdm_getproc( hdbc, en_AllocHandle );
-
-                       if( hproc )
-                       {
-                               CALL_DRIVER ( hdbc, retcode, hproc, en_AllocHandle, 
-                                       ( SQL_HANDLE_ENV, SQL_NULL_HANDLE, &(penv->dhenv) )
-                       }
-                       else /* try driver's SQLAllocEnv() */
+                        hproc = _iodbcdm_getproc( hdbc, en_AllocHandle );
+
+                        if( hproc )
+                        {
+                                CALL_DRIVER ( hdbc, retcode, hproc, en_AllocHandle,
+                                        ( SQL_HANDLE_ENV, SQL_NULL_HANDLE, &(penv->dhenv) )
+                        }
+                        else /* try driver's SQLAllocEnv() */
 #endif
-                       {
-                               hproc = _iodbcdm_getproc( hdbc, en_AllocEnv );
-
-                               if( hproc == SQL_NULL_HPROC)
-                               {
-                                       sqlstat = en_IM004;
-                               }
-                               else
-                               {
-                                       CALL_DRIVER ( hdbc, retcode, hproc, 
-                                       en_AllocEnv, (&(penv->dhenv)) ) 
-                               }
-                       }
-
-                       if( retcode == SQL_ERROR )
-                       {
-                               sqlstat = en_IM004;
-                       }
-
-                       if( sqlstat != en_00000 )
-                       {
-                               _iodbcdm_dllclose ( hdll );
-                               MEM_FREE ( penv );
-                               PUSHSQLERR ( pdbc->herr, en_IM004 );
-       
-                               return SQL_ERROR;
-                       }
-       
-                       /* insert into dll env list */
-                       penv->next = (ENV_t FAR*)genv->henv;
-                       genv->henv = penv;
-       
-                       /* initiate this new env entry */
-                       penv->refcount = 0;     /* we will increase it after
-                                                * driver's SQLAllocConnect()
-                                                * success
-                                                */
-               }
-       
-               pdbc->henv = penv;
-       
-               if( pdbc->dhdbc == SQL_NULL_HDBC )
-               {
+                        {
+                                hproc = _iodbcdm_getproc( hdbc, en_AllocEnv );
+
+                                if( hproc == SQL_NULL_HPROC)
+                                {
+                                        sqlstat = en_IM004;
+                                }
+                                else
+                                {
+                                        CALL_DRIVER ( hdbc, retcode, hproc,
+                                        en_AllocEnv, (&(penv->dhenv)) )
+                                }
+                        }
+
+                        if( retcode == SQL_ERROR )
+                        {
+                                sqlstat = en_IM004;
+                        }
+
+                        if( sqlstat != en_00000 )
+                        {
+                                _iodbcdm_dllclose ( hdll );
+                                MEM_FREE ( penv );
+                                PUSHSQLERR ( pdbc->herr, en_IM004 );
+
+                                return SQL_ERROR;
+                        }
+
+                        /* insert into dll env list */
+                        penv->next = (ENV_t FAR*)genv->henv;
+                        genv->henv = penv;
+
+                        /* initiate this new env entry */
+                        penv->refcount = 0;     /* we will increase it after
+                                                 * driver's SQLAllocConnect()
+                                                 * success
+                                                 */
+                }
+
+                pdbc->henv = penv;
+
+                if( pdbc->dhdbc == SQL_NULL_HDBC )
+                {
 #if (ODBCVER >= 0x0300)
-                       hproc = _iodbcdm_getproc( hdbc, en_AllocHandle );
-
-                       if( hproc )
-                       {
-                               CALL_DRIVER( hdbc, retcode, hproc, en_AllocHandle,
-                               (SQL_HANDLE_DBC, penv->dhenv, &(pdbc->dhdbc)) )
-                       }
-                       else
+                        hproc = _iodbcdm_getproc( hdbc, en_AllocHandle );
+
+                        if( hproc )
+                        {
+                                CALL_DRIVER( hdbc, retcode, hproc, en_AllocHandle,
+                                (SQL_HANDLE_DBC, penv->dhenv, &(pdbc->dhdbc)) )
+                        }
+                        else
 #endif
-                       {
-                               hproc = _iodbcdm_getproc( hdbc, en_AllocConnect );
-       
-                               if( hproc == SQL_NULL_HPROC )
-                               {
-                                       sqlstat = en_IM005;
-                               }
-                               else
-                               {
-                                       CALL_DRIVER ( hdbc, retcode, hproc, 
-                                       en_AllocConnect, (penv->dhenv, &(pdbc->dhdbc)) )
-                               }
-                       }
-
-                       if( retcode == SQL_ERROR )
-                       {
-                               sqlstat = en_IM005;
-                       }
-
-                       if( sqlstat != en_00000 )
-                       {
-                               _iodbcdm_driverunload(hdbc);
-       
-                               pdbc->dhdbc = SQL_NULL_HDBC;
-                               PUSHSQLERR ( pdbc->herr, en_IM005 );
-       
-                               return SQL_ERROR;
-                       }
-               }
-       
-               pdbc->henv = penv;
-               penv->refcount ++;  /* bookkeeping reference count on this driver */
-       }
-
-       /* driver's login timeout option must been set before 
-        * its SQLConnect() call */
-       if( pdbc->login_timeout != 0UL )
-       {
-               hproc = _iodbcdm_getproc( hdbc, en_SetConnectOption );
-
-               if( hproc == SQL_NULL_HPROC )
-               {
-                       sqlstat = en_IM004;
-               }
-               else
-               {
-                       CALL_DRIVER ( hdbc, retcode, hproc, 
-                       en_SetConnectOption, ( 
-                               pdbc->dhdbc, 
-                               SQL_LOGIN_TIMEOUT,
-                               pdbc->login_timeout ) )
-               
-                       if( retcode == SQL_ERROR )
-                       {
-                               PUSHSQLERR ( pdbc->herr, en_IM006 );
-
-                               return SQL_SUCCESS_WITH_INFO;
-                       }
-               }
-       }
-
-       return SQL_SUCCESS;
+                        {
+                                hproc = _iodbcdm_getproc( hdbc, en_AllocConnect );
+
+                                if( hproc == SQL_NULL_HPROC )
+                                {
+                                        sqlstat = en_IM005;
+                                }
+                                else
+                                {
+                                        CALL_DRIVER ( hdbc, retcode, hproc,
+                                        en_AllocConnect, (penv->dhenv, &(pdbc->dhdbc)) )
+                                }
+                        }
+
+                        if( retcode == SQL_ERROR )
+                        {
+                                sqlstat = en_IM005;
+                        }
+
+                        if( sqlstat != en_00000 )
+                        {
+                                _iodbcdm_driverunload(hdbc);
+
+                                pdbc->dhdbc = SQL_NULL_HDBC;
+                                PUSHSQLERR ( pdbc->herr, en_IM005 );
+
+                                return SQL_ERROR;
+                        }
+                }
+
+                pdbc->henv = penv;
+                penv->refcount ++;  /* bookkeeping reference count on this driver */
+        }
+
+        /* driver's login timeout option must been set before
+         * its SQLConnect() call */
+        if( pdbc->login_timeout != 0UL )
+        {
+                hproc = _iodbcdm_getproc( hdbc, en_SetConnectOption );
+
+                if( hproc == SQL_NULL_HPROC )
+                {
+                        sqlstat = en_IM004;
+                }
+                else
+                {
+                        CALL_DRIVER ( hdbc, retcode, hproc,
+                        en_SetConnectOption, (
+                                pdbc->dhdbc,
+                                SQL_LOGIN_TIMEOUT,
+                                pdbc->login_timeout ) )
+
+                        if( retcode == SQL_ERROR )
+                        {
+                                PUSHSQLERR ( pdbc->herr, en_IM006 );
+
+                                return SQL_SUCCESS_WITH_INFO;
+                        }
+                }
+        }
+
+        return SQL_SUCCESS;
 }
 
-RETCODE        _iodbcdm_driverunload( HDBC     hdbc )
+RETCODE _iodbcdm_driverunload( HDBC     hdbc )
 /* - Call driver's SQLFreeConnect()
  * - Call driver's SQLFreeEnv() ( for the last reference only)
  * - Unload the share library( or decrease its reference
@@ -288,975 +299,1078 @@ RETCODE        _iodbcdm_driverunload( HDBC     hdbc )
  * - state transition to allocated
  */
 {
-       DBC_t  FAR*     pdbc = (DBC_t FAR*)hdbc;
-       ENV_t  FAR*     penv;
-       ENV_t  FAR*     tpenv;
-       GENV_t FAR*     genv;
-       HPROC           hproc;
-       RETCODE         retcode = SQL_SUCCESS;
-/*     int             sqlstat = en_00000; */
-
-       if( hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       /* no pointer check will be performed in this function */
-       penv = (ENV_t  FAR*)pdbc->henv;
-       genv = (GENV_t FAR*)pdbc->genv;
-
-       if( penv == NULL 
-        || penv->hdll == SQL_NULL_HDLL )
-       {
-               return SQL_SUCCESS;
-       }
+        DBC_t  FAR*     pdbc = (DBC_t FAR*)hdbc;
+        ENV_t  FAR*     penv;
+        ENV_t  FAR*     tpenv;
+        GENV_t FAR*     genv;
+        HPROC           hproc;
+        RETCODE         retcode = SQL_SUCCESS;
+        int             sqlstat = en_00000;
+
+        if( hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        /* no pointer check will be performed in this function */
+        penv = (ENV_t  FAR*)pdbc->henv;
+        genv = (GENV_t FAR*)pdbc->genv;
+
+        if( penv == NULL
+         || penv->hdll == SQL_NULL_HDLL )
+        {
+                return SQL_SUCCESS;
+        }
 
 #if (ODBCVER >= 0x0300)
-       hproc = _iodbcdm_getproc( hdbc, en_FreeHandle );
-
-       if( hproc )
-       {
-               CALL_DRIVER ( hdbc, retcode, hproc, en_FreeHandle,
-                       ( SQL_HANDLE_DBC, pdbc->dhdbc ) )
-       }
-       else
+        hproc = _iodbcdm_getproc( hdbc, en_FreeHandle );
+
+        if( hproc )
+        {
+                CALL_DRIVER ( hdbc, retcode, hproc, en_FreeHandle,
+                        ( SQL_HANDLE_DBC, pdbc->dhdbc ) )
+        }
+        else
 #endif
-       {
-               hproc = _iodbcdm_getproc( hdbc, en_FreeConnect );
+        {
+                hproc = _iodbcdm_getproc( hdbc, en_FreeConnect );
 
-               if( hproc != SQL_NULL_HPROC )
-               {
-                       CALL_DRIVER ( hdbc, retcode, hproc, 
-                       en_FreeConnect, ( pdbc->dhdbc ) )
+                if( hproc != SQL_NULL_HPROC )
+                {
+                        CALL_DRIVER ( hdbc, retcode, hproc,
+                        en_FreeConnect, ( pdbc->dhdbc ) )
 
-                       pdbc->dhdbc = SQL_NULL_HDBC;
-               }
-       }
+                        pdbc->dhdbc = SQL_NULL_HDBC;
+                }
+        }
 
-       penv->refcount --;
+        penv->refcount --;
 
-       if( ! penv->refcount )
-       /* no other connections still attaching with this driver */
-       {
+        if( ! penv->refcount )
+        /* no other connections still attaching with this driver */
+        {
 #if (ODBCVER >= 0x0300)
-               hproc = _iodbcdm_getproc( hdbc, en_FreeHandle );
-
-               if( hproc )
-               {
-                       CALL_DRIVER ( hdbc, retcode, hproc, en_FreeHandle,
-                               ( SQL_HANDLE_ENV, penv->dhenv ) )
-               }
-               else
+                hproc = _iodbcdm_getproc( hdbc, en_FreeHandle );
+
+                if( hproc )
+                {
+                        CALL_DRIVER ( hdbc, retcode, hproc, en_FreeHandle,
+                                ( SQL_HANDLE_ENV, penv->dhenv ) )
+                }
+                else
 #endif
-               {
-                       hproc = _iodbcdm_getproc( hdbc, en_FreeEnv );
-
-                       if( hproc != SQL_NULL_HPROC )
-                       {
-                               CALL_DRIVER ( hdbc, retcode, hproc, en_FreeEnv, 
-                                               ( penv->dhenv ) )
-
-                               penv->dhenv = SQL_NULL_HENV;
-                       }
-               }
-
-               _iodbcdm_dllclose ( penv->hdll );
-
-               penv->hdll = SQL_NULL_HDLL; 
-
-               for( tpenv  = (ENV_t FAR*)genv->henv;
-                    tpenv != NULL;
-                    tpenv  = (ENV_t FAR*)penv->next )
-               {
-                       if( tpenv == penv )
-                       {
-                               genv->henv = penv->next;
-                               break;
-                       }
-       
-                       if( tpenv->next == penv )
-                       {
-                               tpenv->next = penv->next;
-                               break;
-                       }
-               }
-
-               MEM_FREE( penv );
-       }
-
-       pdbc->henv = SQL_NULL_HENV;     
-       pdbc->hstmt= SQL_NULL_HSTMT;
-       /* pdbc->herr = SQL_NULL_HERR; 
-               -- delay to DM's SQLFreeConnect() */ 
-       pdbc->dhdbc= SQL_NULL_HDBC;     
-       pdbc->state= en_dbc_allocated;  
-
-       /* set connect options to default values */
-       /**********
-       pdbc->access_mode       = SQL_MODE_DEFAULT;
-       pdbc->autocommit        = SQL_AUTOCOMMIT_DEFAULT;
-       pdbc->login_timeout     = 0UL;
-       **********/
-       pdbc->odbc_cursors      = SQL_CUR_DEFAULT;
-       pdbc->packet_size       = 0UL;
-       pdbc->quiet_mode        = (UDWORD)NULL;
-       pdbc->txn_isolation     = SQL_TXN_READ_UNCOMMITTED;
-
-       if( pdbc->current_qualifier != NULL )
-       {
-               MEM_FREE ( pdbc->current_qualifier );
-               pdbc->current_qualifier = NULL;
-       }
-
-       return SQL_SUCCESS;
+                {
+                        hproc = _iodbcdm_getproc( hdbc, en_FreeEnv );
+
+                        if( hproc != SQL_NULL_HPROC )
+                        {
+                                CALL_DRIVER ( hdbc, retcode, hproc, en_FreeEnv,
+                                                ( penv->dhenv ) )
+
+                                penv->dhenv = SQL_NULL_HENV;
+                        }
+                }
+
+                _iodbcdm_dllclose ( penv->hdll );
+
+                penv->hdll == SQL_NULL_HDLL;
+
+                for( tpenv  = (ENV_t FAR*)genv->henv;
+                     tpenv != NULL;
+                     tpenv  = (ENV_t FAR*)penv->next )
+                {
+                        if( tpenv == penv )
+                        {
+                                genv->henv = penv->next;
+                                break;
+                        }
+
+                        if( tpenv->next == penv )
+                        {
+                                tpenv->next = penv->next;
+                                break;
+                        }
+                }
+
+                MEM_FREE( penv );
+        }
+
+        pdbc->henv = SQL_NULL_HENV;
+        pdbc->hstmt= SQL_NULL_HSTMT;
+        /* pdbc->herr = SQL_NULL_HERR;
+                -- delay to DM's SQLFreeConnect() */
+        pdbc->dhdbc= SQL_NULL_HDBC;
+        pdbc->state= en_dbc_allocated;
+
+        /* set connect options to default values */
+        /**********
+        pdbc->access_mode       = SQL_MODE_DEFAULT;
+        pdbc->autocommit        = SQL_AUTOCOMMIT_DEFAULT;
+        pdbc->login_timeout     = 0UL;
+        **********/
+        pdbc->odbc_cursors      = SQL_CUR_DEFAULT;
+        pdbc->packet_size       = 0UL;
+        pdbc->quiet_mode        = (UDWORD)NULL;
+        pdbc->txn_isolation     = SQL_TXN_READ_UNCOMMITTED;
+
+        if( pdbc->current_qualifier != NULL )
+        {
+                MEM_FREE ( pdbc->current_qualifier );
+                pdbc->current_qualifier = NULL;
+        }
+
+        return SQL_SUCCESS;
 }
 
-static RETCODE _iodbcdm_dbcdelayset( HDBC hdbc )
+static RETCODE  _iodbcdm_dbcdelayset( HDBC hdbc )
 {
-       DBC_t FAR*      pdbc    = (DBC_t FAR*)hdbc;
-       ENV_t FAR*      penv;
-       HPROC           hproc;
-       RETCODE         retcode = SQL_SUCCESS;
-       RETCODE         ret;
-
-       penv = pdbc->henv;
-
-       hproc = _iodbcdm_getproc( hdbc, en_SetConnectOption );
-
-       if( hproc == SQL_NULL_HPROC )
-       {
-               PUSHSQLERR ( pdbc->herr, en_IM006 );
-
-               return SQL_SUCCESS_WITH_INFO;
-       }
-
-       if( pdbc->access_mode != SQL_MODE_DEFAULT )
-       {
-               CALL_DRIVER ( hdbc, ret, hproc, 
-                       en_SetConnectOption, ( 
-                               SQL_ACCESS_MODE, 
-                               pdbc->access_mode) )
-
-               retcode |= ret;
-       }
-
-       if( pdbc->autocommit != SQL_AUTOCOMMIT_DEFAULT )
-       {
-               CALL_DRIVER ( hdbc, ret, hproc, 
-                       en_SetConnectOption, (
-                               pdbc->dhdbc,
-                               SQL_AUTOCOMMIT,
-                               pdbc->autocommit ) )
-
-               retcode |= ret;
-       }
-
-       if( pdbc->current_qualifier != NULL )
-       {
-               CALL_DRIVER ( hdbc, ret, hproc, 
-                       en_SetConnectOption, (
-                               pdbc->dhdbc,
-                               SQL_CURRENT_QUALIFIER,
-                               pdbc->current_qualifier ) )
-
-               retcode |= ret;
-       }
-
-       if( pdbc->packet_size != 0UL )
-       {
-               CALL_DRIVER ( hdbc, ret, hproc,
-                       en_SetConnectOption, (
-                               pdbc->dhdbc,
-                               SQL_PACKET_SIZE,
-                               pdbc->packet_size ) )
-
-               retcode |= ret;
-       }
-
-       if( pdbc->quiet_mode != (UDWORD)NULL )
-       {
-               CALL_DRIVER ( hdbc, ret, hproc, 
-                       en_SetConnectOption, (
-                               pdbc->dhdbc,
-                               SQL_QUIET_MODE,
-                               pdbc->quiet_mode ) )
-
-               retcode |= ret;
-       }
-
-       if( pdbc->txn_isolation != SQL_TXN_READ_UNCOMMITTED )
-       {
-               CALL_DRIVER ( hdbc, ret, hproc,
-                       en_SetConnectOption, (
-                               pdbc->dhdbc,
-                               SQL_TXN_ISOLATION,
-                               pdbc->txn_isolation ) )
-       }
-
-       /* check error code for driver's SQLSetConnectOption() call */
-       if( retcode != SQL_SUCCESS 
-        && retcode != SQL_SUCCESS_WITH_INFO )
-       {
-               PUSHSQLERR ( pdbc->herr, en_IM006 );
-
-               retcode = SQL_ERROR;
-       }
-
-       /* get cursor behavior on transaction commit or rollback */
-       hproc = _iodbcdm_getproc( hdbc, en_GetInfo );
-
-       if( hproc == SQL_NULL_HPROC )
-       {
-               PUSHSQLERR ( pdbc->herr, en_01000 );
-
-               return retcode;
-       }
-
-       CALL_DRIVER ( hdbc, ret, hproc,
-               en_GetInfo, (
-                       pdbc->dhdbc, 
-                       SQL_CURSOR_COMMIT_BEHAVIOR,
-                       (PTR)&(pdbc->cb_commit),
-                       sizeof(pdbc->cb_commit),
-                       NULL ) )
-
-       retcode |= ret;
-
-       CALL_DRIVER ( hdbc, ret, hproc,
-               en_GetInfo, (
-                       pdbc->dhdbc,
-                       SQL_CURSOR_ROLLBACK_BEHAVIOR,
-                       (PTR)&(pdbc->cb_rollback),
-                       sizeof(pdbc->cb_rollback),
-                       NULL ) )
-
-       retcode |= ret;
-
-       if( retcode != SQL_SUCCESS
-        && retcode != SQL_SUCCESS_WITH_INFO )
-       {
-               return SQL_ERROR;
-       }
-
-       return retcode;
+        DBC_t FAR*      pdbc    = (DBC_t FAR*)hdbc;
+        ENV_t FAR*      penv;
+        HPROC           hproc;
+        RETCODE         retcode = SQL_SUCCESS;
+        RETCODE         ret;
+
+        penv = pdbc->henv;
+
+        hproc = _iodbcdm_getproc( hdbc, en_SetConnectOption );
+
+        if( hproc == SQL_NULL_HPROC )
+        {
+                PUSHSQLERR ( pdbc->herr, en_IM006 );
+
+                return SQL_SUCCESS_WITH_INFO;
+        }
+
+        if( pdbc->access_mode != SQL_MODE_DEFAULT )
+        {
+                CALL_DRIVER ( hdbc, ret, hproc,
+                        en_SetConnectOption, (
+                                SQL_ACCESS_MODE,
+                                pdbc->access_mode) )
+
+                retcode |= ret;
+        }
+
+        if( pdbc->autocommit != SQL_AUTOCOMMIT_DEFAULT )
+        {
+                CALL_DRIVER ( hdbc, ret, hproc,
+                        en_SetConnectOption, (
+                                pdbc->dhdbc,
+                                SQL_AUTOCOMMIT,
+                                pdbc->autocommit ) )
+
+                retcode |= ret;
+        }
+
+        if( pdbc->current_qualifier != NULL )
+        {
+                CALL_DRIVER ( hdbc, ret, hproc,
+                        en_SetConnectOption, (
+                                pdbc->dhdbc,
+                                SQL_CURRENT_QUALIFIER,
+                                pdbc->current_qualifier ) )
+
+                retcode |= ret;
+        }
+
+        if( pdbc->packet_size != 0UL )
+        {
+                CALL_DRIVER ( hdbc, ret, hproc,
+                        en_SetConnectOption, (
+                                pdbc->dhdbc,
+                                SQL_PACKET_SIZE,
+                                pdbc->packet_size ) )
+
+                retcode |= ret;
+        }
+
+        if( pdbc->quiet_mode != (UDWORD)NULL )
+        {
+                CALL_DRIVER ( hdbc, ret, hproc,
+                        en_SetConnectOption, (
+                                pdbc->dhdbc,
+                                SQL_QUIET_MODE,
+                                pdbc->quiet_mode ) )
+
+                retcode |= ret;
+        }
+
+        if( pdbc->txn_isolation != SQL_TXN_READ_UNCOMMITTED )
+        {
+                CALL_DRIVER ( hdbc, ret, hproc,
+                        en_SetConnectOption, (
+                                pdbc->dhdbc,
+                                SQL_TXN_ISOLATION,
+                                pdbc->txn_isolation ) )
+        }
+
+        /* check error code for driver's SQLSetConnectOption() call */
+        if( retcode != SQL_SUCCESS
+         && retcode != SQL_SUCCESS_WITH_INFO )
+        {
+                PUSHSQLERR ( pdbc->herr, en_IM006 );
+
+                retcode = SQL_ERROR;
+        }
+
+        /* get cursor behavior on transaction commit or rollback */
+        hproc = _iodbcdm_getproc( hdbc, en_GetInfo );
+
+        if( hproc == SQL_NULL_HPROC )
+        {
+                PUSHSQLERR ( pdbc->herr, en_01000 );
+
+                return retcode;
+        }
+
+        CALL_DRIVER ( hdbc, ret, hproc,
+                en_GetInfo, (
+                        pdbc->dhdbc,
+                        SQL_CURSOR_COMMIT_BEHAVIOR,
+                        (PTR)&(pdbc->cb_commit),
+                        sizeof(pdbc->cb_commit),
+                        NULL ) )
+
+        retcode |= ret;
+
+        CALL_DRIVER ( hdbc, ret, hproc,
+                en_GetInfo, (
+                        pdbc->dhdbc,
+                        SQL_CURSOR_ROLLBACK_BEHAVIOR,
+                        (PTR)&(pdbc->cb_rollback),
+                        sizeof(pdbc->cb_rollback),
+                        NULL ) )
+
+        retcode |= ret;
+
+        if( retcode != SQL_SUCCESS
+         && retcode != SQL_SUCCESS_WITH_INFO )
+        {
+                return SQL_ERROR;
+        }
+
+        return retcode;
 }
 
-static RETCODE _iodbcdm_settracing( HDBC hdbc, char* dsn, int dsnlen )
+static RETCODE  _iodbcdm_settracing( HDBC hdbc, char* dsn, int dsnlen )
 {
-       char    buf[256];
-       char*   ptr;
-       RETCODE setopterr = SQL_SUCCESS;
-
-       /* Get Driver's DLL path from specificed or default dsn section */
-       ptr = _iodbcdm_getkeyvalbydsn( dsn, dsnlen, "TraceFile",
-                               (char FAR*)buf, sizeof(buf));
-
-       if( ptr == NULL || ptr[0] == '\0' )
-       {
-               ptr = (char FAR*)(SQL_OPT_TRACE_FILE_DEFAULT);
-       }
-
-       setopterr |= SQLSetConnectOption( hdbc, 
-               SQL_OPT_TRACEFILE, (UDWORD)(ptr));
-
-       ptr = _iodbcdm_getkeyvalbydsn( dsn, dsnlen, "Trace",
-                               (char FAR*)buf, sizeof(buf));
-
-       if( ptr != NULL )
-       {
-               UDWORD  opt = (UDWORD)(-1L);
-
-               if( STREQ(ptr, "ON") 
-                || STREQ(ptr, "On") 
-                || STREQ(ptr, "on") 
-                || STREQ(ptr, "1" ) )
-               {
-                       opt = SQL_OPT_TRACE_ON;
-               }
-
-               if( STREQ(ptr, "OFF") 
-                || STREQ(ptr, "Off")
-                || STREQ(ptr, "off") 
-                || STREQ(ptr, "0"  ) )
-               {
-                       opt = SQL_OPT_TRACE_OFF;
-               }
-
-               if( opt != (UDWORD)(-1L) )
-               {
-                       setopterr |= SQLSetConnectOption( hdbc, 
-                               SQL_OPT_TRACE, opt);
-               }
-       }
-
-    return setopterr;
+        char    buf[256];
+        char*   ptr;
+        RETCODE setopterr = SQL_SUCCESS;
+
+        /* Get Driver's DLL path from specificed or default dsn section */
+        ptr = _iodbcdm_getkeyvalbydsn( dsn, dsnlen, "TraceFile",
+                                (char FAR*)buf, sizeof(buf));
+
+        if( ptr == NULL || ptr[0] == '\0' )
+        {
+                ptr = (char FAR*)(SQL_OPT_TRACE_FILE_DEFAULT);
+        }
+
+        setopterr |= SQLSetConnectOption( hdbc,
+                SQL_OPT_TRACEFILE, (UDWORD)(ptr));
+
+        ptr = _iodbcdm_getkeyvalbydsn( dsn, dsnlen, "Trace",
+                                (char FAR*)buf, sizeof(buf));
+
+        if( ptr != NULL )
+        {
+                UDWORD  opt = (UDWORD)(-1L);
+
+                if( STREQ(ptr, "ON")
+                 || STREQ(ptr, "On")
+                 || STREQ(ptr, "on")
+                 || STREQ(ptr, "1" ) )
+                {
+                        opt = SQL_OPT_TRACE_ON;
+                }
+
+                if( STREQ(ptr, "OFF")
+                 || STREQ(ptr, "Off")
+                 || STREQ(ptr, "off")
+                 || STREQ(ptr, "0"  ) )
+                {
+                        opt = SQL_OPT_TRACE_OFF;
+                }
+
+                if( opt != (UDWORD)(-1L) )
+                {
+                        setopterr |= SQLSetConnectOption( hdbc,
+                                SQL_OPT_TRACE, opt);
+                }
+        }
+       return SQL_SUCCESS;
 }
 
-RETCODE SQL_API        SQLConnect (
-                       HDBC            hdbc,
-                       UCHAR FAR*      szDSN,
-                       SWORD           cbDSN,
-                       UCHAR FAR*      szUID,
-                       SWORD           cbUID,
-                       UCHAR FAR*      szAuthStr,
-                       SWORD           cbAuthStr)
+RETCODE SQL_API SQLConnect (
+                        HDBC            hdbc,
+                        UCHAR FAR*      szDSN,
+                        SWORD           cbDSN,
+                        UCHAR FAR*      szUID,
+                        SWORD           cbUID,
+                        UCHAR FAR*      szAuthStr,
+                        SWORD           cbAuthStr)
 {
-       DBC_t  FAR*     pdbc    = (DBC_t FAR*)hdbc;
-       RETCODE         retcode = SQL_SUCCESS;
-       RETCODE         setopterr = SQL_SUCCESS;
-       char            driver[1024] = { '\0' }; /* MS SDK Guide 
-                                                 * specifies driver
-                                                 * path can't longer
-                                                 * than 255. */
-       char            *ptr;
-       HPROC           hproc;
-       
-       if( hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       /* check arguments */
-       if( ( cbDSN < 0 && cbDSN != SQL_NTS )
-        || ( cbUID < 0 && cbUID != SQL_NTS )
-        || ( cbAuthStr < 0 && cbAuthStr != SQL_NTS )
-        || ( cbDSN > SQL_MAX_DSN_LENGTH ) )
-       {
-               PUSHSQLERR ( pdbc->herr, en_S1090 );
-
-               return SQL_ERROR;
-       }
-
-       if( szDSN == NULL || cbDSN == 0 )
-       {
-               PUSHSQLERR ( pdbc->herr, en_IM002 );
-               
-               return SQL_ERROR;
-       }
-
-       /* check state */
-       if( pdbc->state != en_dbc_allocated )
-       {
-               PUSHSQLERR ( pdbc->herr, en_08002 );
-
-               return SQL_ERROR;
-       }
-
-       setopterr |= _iodbcdm_settracing( hdbc, 
-                               (char*)szDSN, cbDSN );
-
-       ptr = _iodbcdm_getkeyvalbydsn( szDSN, cbDSN, "Driver", 
-                               (char FAR*)driver, sizeof(driver));
-
-       if( ptr == NULL )
-       /* No specified or default dsn section or
-        * no driver specification in this dsn section */
-       {
-               PUSHSQLERR ( pdbc->herr, en_IM002 );
-
-               return SQL_ERROR;
-       }
-
-       retcode = _iodbcdm_driverload( driver, hdbc );
-
-       switch( retcode )
-       {
-               case SQL_SUCCESS:
-                       break;
-
-               case SQL_SUCCESS_WITH_INFO:
-                       setopterr = SQL_ERROR;
-                       /* unsuccessed in calling driver's 
-                        * SQLSetConnectOption() to set login
-                        * timeout.
-                        */
-                       break;
-
-               default:
-                       return retcode;
-       }
-
-       hproc = _iodbcdm_getproc( hdbc, en_Connect );
-
-       if( hproc == SQL_NULL_HPROC )
-       {
-               _iodbcdm_driverunload( hdbc );
-
-               PUSHSQLERR ( pdbc->herr, en_IM001 );
-
-               return SQL_ERROR;
-       }
-
-       CALL_DRIVER ( hdbc, retcode, hproc, en_Connect, (
-                       pdbc->dhdbc, 
-                       szDSN,     cbDSN,
-                       szUID,     cbUID,
-                       szAuthStr, cbAuthStr ) )
+        DBC_t  FAR*     pdbc    = (DBC_t FAR*)hdbc;
+        RETCODE         retcode = SQL_SUCCESS;
+        RETCODE         setopterr = SQL_SUCCESS;
+        char            driver[1024] = { '\0' }; /* MS SDK Guide
+                                                  * specifies driver
+                                                  * path can't longer
+                                                  * than 255. */
+        char            szNewDSN[256];                  /* OS/2 !!! */
+        char            *ptr;
+        HPROC           hproc;
+
+        if( hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        /* check arguments */
+        if( ( cbDSN < 0 && cbDSN != SQL_NTS )
+         || ( cbUID < 0 && cbUID != SQL_NTS )
+         || ( cbAuthStr < 0 && cbAuthStr != SQL_NTS )
+         || ( cbDSN > SQL_MAX_DSN_LENGTH ) )
+        {
+                PUSHSQLERR ( pdbc->herr, en_S1090 );
+
+                return SQL_ERROR;
+        }
+
+        if( szDSN == NULL || cbDSN == 0 )
+        {
+                PUSHSQLERR ( pdbc->herr, en_IM002 );
+
+                return SQL_ERROR;
+        }
+
+        /* check state */
+        if( pdbc->state != en_dbc_allocated )
+        {
+                PUSHSQLERR ( pdbc->herr, en_08002 );
+
+                return SQL_ERROR;
+        }
+
+        setopterr |= _iodbcdm_settracing( hdbc,
+                                (char*)szDSN, cbDSN );
+
+        ptr = _iodbcdm_getkeyvalbydsn( szDSN, cbDSN, "Driver",
+                                (char FAR*)driver, sizeof(driver));
+
+        if( ptr == NULL )
+        /* No specified or default dsn section or
+         * no driver specification in this dsn section */
+        {
+                PUSHSQLERR ( pdbc->herr, en_IM002 );
+
+                return SQL_ERROR;
+        }
+
+        /*
+        ** OS/2 !!!
+        **
+        ** get new szDSN from INI file, if existing
+        */
+        if( NULL != _iodbcdm_getkeyvalbydsn( szDSN, cbDSN, "DSN",
+                                             (char FAR*) &szNewDSN,
+                                             sizeof(szNewDSN) ) )
+        {
+                szDSN = &szNewDSN[0];
+                cbDSN = SQL_NTS;
+        }
+
+        retcode = _iodbcdm_driverload( driver, hdbc );
+
+        switch( retcode )
+        {
+                case SQL_SUCCESS:
+                        break;
+
+                case SQL_SUCCESS_WITH_INFO:
+                        setopterr = SQL_ERROR;
+                        /* unsuccessed in calling driver's
+                         * SQLSetConnectOption() to set login
+                         * timeout.
+                         */
+                        break;
+
+                default:
+                        return retcode;
+        }
+
+        hproc = _iodbcdm_getproc( hdbc, en_Connect );
+
+        if( hproc == SQL_NULL_HPROC )
+        {
+                _iodbcdm_driverunload( hdbc );
+
+                PUSHSQLERR ( pdbc->herr, en_IM001 );
+
+                return SQL_ERROR;
+        }
+
+        CALL_DRIVER ( hdbc, retcode, hproc, en_Connect, (
+                        pdbc->dhdbc,
+                        szDSN,     cbDSN,
+                        szUID,     cbUID,
+                        szAuthStr, cbAuthStr ) )
 
 #if 0
-       retcode = hproc(pdbc->dhdbc, 
-                       szDSN,     cbDSN,
-                       szUID,     cbUID,
-                       szAuthStr, cbAuthStr );
+        retcode = hproc(pdbc->dhdbc,
+                        szDSN,     cbDSN,
+                        szUID,     cbUID,
+                        szAuthStr, cbAuthStr );
 #endif
 
-       if( retcode != SQL_SUCCESS 
-        && retcode != SQL_SUCCESS_WITH_INFO )
-       {
-               /* not unload driver for retrive error 
-                * messge from driver */
-               /*********
-               _iodbcdm_driverunload( hdbc );
-               **********/
+        if( retcode != SQL_SUCCESS
+         && retcode != SQL_SUCCESS_WITH_INFO )
+        {
+                /* not unload driver for retrive error
+                 * messge from driver */
+                /*********
+                _iodbcdm_driverunload( hdbc );
+                **********/
 
-               return retcode;
-       }
+                return retcode;
+        }
 
-       /* state transition */
-       pdbc->state = en_dbc_connected;
+        /* state transition */
+        pdbc->state = en_dbc_connected;
 
-       /* do delaid option setting */
-       setopterr |= _iodbcdm_dbcdelayset( hdbc );
+        /* do delaid option setting */
+        setopterr |= _iodbcdm_dbcdelayset( hdbc );
 
-       if( setopterr != SQL_SUCCESS )
-       {
-               return SQL_SUCCESS_WITH_INFO;
-       }
+        if( setopterr != SQL_SUCCESS )
+        {
+                return SQL_SUCCESS_WITH_INFO;
+        }
 
-       return retcode;
+        return retcode;
 }
-       
-RETCODE SQL_API        SQLDriverConnect (
-                       HDBC            hdbc,
-                       HWND            hwnd,
-                       UCHAR FAR*      szConnStrIn,
-                       SWORD           cbConnStrIn,
-                       UCHAR FAR*      szConnStrOut,
-                       SWORD           cbConnStrOutMax,
-                       SWORD FAR*      pcbConnStrOut,
-                       UWORD           fDriverCompletion )
-{
-       DBC_t FAR*      pdbc    = (DBC_t FAR*)hdbc;
-       HDLL            hdll;
-       char  FAR*      drv;
-       char            drvbuf[1024];
-       char  FAR*      dsn;
-       char            dsnbuf[SQL_MAX_DSN_LENGTH + 1];
-       UCHAR           cnstr2drv[1024];
-
-       HPROC           hproc, dialproc;
-
-       int             sqlstat = en_00000;
-       RETCODE         retcode = SQL_SUCCESS;
-       RETCODE         setopterr = SQL_SUCCESS;
-
-       if( hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       /* check arguments */
-       if( ( cbConnStrIn < 0 && cbConnStrIn != SQL_NTS )
-        || cbConnStrOutMax < 0 )
-       {
-               PUSHSQLERR (pdbc->herr, en_S1090 );
-
-               return SQL_ERROR;
-       }
-
-       /* check state */
-       if( pdbc->state != en_dbc_allocated )
-       {
-               PUSHSQLERR (pdbc->herr, en_08002 );
-
-               return SQL_ERROR;
-       }
-
-       drv = _iodbcdm_getkeyvalinstr(szConnStrIn, cbConnStrIn, 
-                               "DRIVER", drvbuf, sizeof(drvbuf));
-
-       dsn = _iodbcdm_getkeyvalinstr(szConnStrIn, cbConnStrIn,
-                               "DSN",    dsnbuf, sizeof(dsnbuf));
-
-       switch( fDriverCompletion )
-       {
-               case SQL_DRIVER_NOPROMPT:
-                       break;
-
-               case SQL_DRIVER_COMPLETE:
-               case SQL_DRIVER_COMPLETE_REQUIRED:
-                       if( dsn != NULL )
-                       {
-                               break;
-                       }
-                       /* fall to next case */
-               case SQL_DRIVER_PROMPT:
-                       /* Get data source dialog box function from
-                        * current executable */
-                       hdll = _iodbcdm_dllopen((char FAR*)NULL);
-                       dialproc = _iodbcdm_dllproc( hdll, 
-                                       "_iodbcdm_drvconn_dialbox");
-
-                       if( dialproc == SQL_NULL_HPROC )
-                       {
-                               sqlstat = en_IM008;
-                               break;
-                       }
-
-                       retcode = dialproc( 
-                                       hwnd,   /* window or display handle */
-                                       dsnbuf, /* input/output dsn buf */
-                                       sizeof(dsnbuf), /* buf size */
-                                       &sqlstat);      /* error code */
-
-                       if( retcode != SQL_SUCCESS )
-                       {
-                               break;
-                       }
-                       
-                       if( cbConnStrIn == SQL_NTS )
-                       {
-                               cbConnStrIn = STRLEN(szConnStrIn );
-                       }
-
-                       dsn = dsnbuf;
-
-                       if( dsn[0] == '\0' )
-                       {
-                               dsn = "default";
-                       }
-
-                       if( cbConnStrIn > sizeof(cnstr2drv) 
-                                       - STRLEN(dsn) - STRLEN("DSN=;") -1 )
-                       {
-                               sqlstat = en_S1001; /* a lazy way to avoid
-                                                    * using heap memory */
-                               break;
-                       }
-
-                       sprintf( (char FAR *)cnstr2drv, "DSN=%s;", dsn);
-                       cbConnStrIn += STRLEN(cnstr2drv);
-                       STRNCAT( cnstr2drv, szConnStrIn, cbConnStrIn );
-                       szConnStrIn = cnstr2drv;
-                       break;
-
-               default:
-                       sqlstat = en_S1110;
-                       break;
-       }
-
-       if( sqlstat != en_00000 )
-       {
-               PUSHSQLERR( pdbc->herr, sqlstat );
-               
-               return SQL_ERROR;
-       }
-
-       if( dsn == NULL || dsn[0] == '\0' )
-       {
-               dsn = "default";
-       }
-       else    /* if you want tracing, you must use a DSN */
-       {
-               setopterr |= _iodbcdm_settracing( hdbc, 
-                                       (char*)dsn, SQL_NTS );
-       }
-
-       if( drv == NULL || drv[0] == '\0' )
-       {
-               drv = _iodbcdm_getkeyvalbydsn( dsn, SQL_NTS, "Driver", 
-                                       drvbuf, sizeof(drvbuf));
-       }
-
-       if( drv == NULL )
-       {
-               PUSHSQLERR( pdbc->herr, en_IM002 );
-
-               return SQL_ERROR;
-       }
 
-       retcode = _iodbcdm_driverload( drv, hdbc );
-
-       switch( retcode )
-       {
-               case SQL_SUCCESS:
-                       break;
-
-               case SQL_SUCCESS_WITH_INFO:
-                       setopterr = SQL_ERROR;
-                       /* unsuccessed in calling driver's 
-                        * SQLSetConnectOption() to set login
-                        * timeout.
-                        */
-                       break;
-
-               default:
-                       return retcode;
-       }
-
-       hproc = _iodbcdm_getproc( hdbc, en_DriverConnect );
-
-       if( hproc == SQL_NULL_HPROC )
-       {
-               _iodbcdm_driverunload( hdbc );
-
-               PUSHSQLERR ( pdbc->herr, en_IM001 );
-
-               return SQL_ERROR;
-       }
-       
-       CALL_DRIVER ( hdbc, retcode, hproc, en_DriverConnect, (
-                       pdbc->dhdbc, hwnd,
-                       szConnStrIn, cbConnStrIn,
-                       szConnStrOut, cbConnStrOutMax,
-                       pcbConnStrOut, fDriverCompletion ) )
+RETCODE SQL_API SQLDriverConnect (
+                        HDBC            hdbc,
+                        HWND            hwnd,
+                        UCHAR FAR*      szConnStrIn,
+                        SWORD           cbConnStrIn,
+                        UCHAR FAR*      szConnStrOut,
+                        SWORD           cbConnStrOutMax,
+                        SWORD FAR*      pcbConnStrOut,
+                        UWORD           fDriverCompletion )
+{
+        DBC_t FAR*      pdbc    = (DBC_t FAR*)hdbc;
+        HDLL            hdll;
+        char  FAR*      drv;
+        char            drvbuf[1024];
+        char  FAR*      dsn;
+        char            dsnbuf[SQL_MAX_DSN_LENGTH + 1];
+        char            szNewDSN[256];                    /* OS/2 !!! */
+        UCHAR           cnstr2drv[1024];
+
+        HPROC           hproc, dialproc;
+
+        int             sqlstat = en_00000;
+        RETCODE         retcode = SQL_SUCCESS;
+        RETCODE         setopterr = SQL_SUCCESS;
+
+        if( hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        /* check arguments */
+        if( ( cbConnStrIn < 0 && cbConnStrIn != SQL_NTS )
+         || cbConnStrOutMax < 0 )
+        {
+                PUSHSQLERR (pdbc->herr, en_S1090 );
+
+                return SQL_ERROR;
+        }
+
+        /* check state */
+        if( pdbc->state != en_dbc_allocated )
+        {
+                PUSHSQLERR (pdbc->herr, en_08002 );
+
+                return SQL_ERROR;
+        }
+
+        drv = _iodbcdm_getkeyvalinstr(szConnStrIn, cbConnStrIn,
+                                "DRIVER", drvbuf, sizeof(drvbuf));
+
+        dsn = _iodbcdm_getkeyvalinstr(szConnStrIn, cbConnStrIn,
+                                "DSN",    dsnbuf, sizeof(dsnbuf));
+
+        switch( fDriverCompletion )
+        {
+                case SQL_DRIVER_NOPROMPT:
+                        break;
+
+                case SQL_DRIVER_COMPLETE:
+                case SQL_DRIVER_COMPLETE_REQUIRED:
+                        if( dsn != NULL )
+                        {
+                                break;
+                        }
+                        /* fall to next case */
+                case SQL_DRIVER_PROMPT:
+                        /* Get data source dialog box function from
+                         * current executable */
+                        hdll = _iodbcdm_dllopen((char FAR*)NULL);
+                        dialproc = _iodbcdm_dllproc( hdll,
+                                        "_iodbcdm_drvconn_dialbox");
+
+                        if( dialproc == SQL_NULL_HPROC )
+                        {
+                                sqlstat = en_IM008;
+                                break;
+                        }
+
+                        retcode = dialproc(
+                                        hwnd,   /* window or display handle */
+                                        dsnbuf, /* input/output dsn buf */
+                                        sizeof(dsnbuf), /* buf size */
+                                        &sqlstat);      /* error code */
+
+                        if( retcode != SQL_SUCCESS )
+                        {
+                                break;
+                        }
+
+                        if( cbConnStrIn == SQL_NTS )
+                        {
+                                cbConnStrIn = STRLEN(szConnStrIn );
+                        }
+
+                        dsn = dsnbuf;
+
+                        if( dsn[0] == '\0' )
+                        {
+                                dsn = "default";
+                        }
+
+                        if( cbConnStrIn > sizeof(cnstr2drv)
+                                        - STRLEN(dsn) - STRLEN("DSN=;") -1 )
+                        {
+                                sqlstat = en_S1001; /* a lazy way to avoid
+                                                     * using heap memory */
+                                break;
+                        }
+
+                        sprintf(cnstr2drv, "DSN=%s;", dsn);
+                        cbConnStrIn += STRLEN(cnstr2drv);
+                        STRNCAT( cnstr2drv, szConnStrIn, cbConnStrIn );
+                        szConnStrIn = cnstr2drv;
+                        break;
+
+                default:
+                        sqlstat = en_S1110;
+                        break;
+        }
+
+        if( sqlstat != en_00000 )
+        {
+                PUSHSQLERR( pdbc->herr, sqlstat );
+
+                return SQL_ERROR;
+        }
+
+        if( dsn == NULL || dsn[0] == '\0' )
+        {
+                dsn = "default";
+        }
+        else    /* if you want tracing, you must use a DSN */
+        {
+                setopterr |= _iodbcdm_settracing( hdbc,
+                                        (char*)dsn, SQL_NTS );
+        }
+
+        if( drv == NULL || drv[0] == '\0' )
+        {
+                drv = _iodbcdm_getkeyvalbydsn( dsn, SQL_NTS, "Driver",
+                                        drvbuf, sizeof(drvbuf));
+        }
+
+        if( drv == NULL )
+        {
+                PUSHSQLERR( pdbc->herr, en_IM002 );
+
+                return SQL_ERROR;
+        }
+
+        retcode = _iodbcdm_driverload( drv, hdbc );
+
+        switch( retcode )
+        {
+                case SQL_SUCCESS:
+                        break;
+
+                case SQL_SUCCESS_WITH_INFO:
+                        setopterr = SQL_ERROR;
+                        /* unsuccessed in calling driver's
+                         * SQLSetConnectOption() to set login
+                         * timeout.
+                         */
+                        break;
+
+                default:
+                        return retcode;
+        }
+
+        hproc = _iodbcdm_getproc( hdbc, en_DriverConnect );
+
+        if( hproc == SQL_NULL_HPROC )
+        {
+                _iodbcdm_driverunload( hdbc );
+
+                PUSHSQLERR ( pdbc->herr, en_IM001 );
+
+                return SQL_ERROR;
+        }
+ /* giovanni */
+        /*
+        ** OS/2 !!!
+        **
+        ** get new szDSN from INI file, if existing
+        */
+        strcpy( szNewDSN, "DSN=" );
+        if( NULL != _iodbcdm_getkeyvalbydsn( dsn, SQL_NTS, "DSN",
+                                             (char FAR*) &szNewDSN[4],
+                                             sizeof(szNewDSN) - 4 ) )
+        {
+                char   *psz;
+
+                strcat( szNewDSN, ";UID=" );
+                psz = strtok( szNewDSN, "\0" );
+
+
+
+
+       if(NULL ==  _iodbcdm_getkeyvalinstr( szConnStrIn, cbConnStrIn,
+                                       /*
+                                         "UID", psz, sizeof(szNewDSN) ))
+                                        */
+                                         "UID", (char FAR*) &szNewDSN[strlen(psz)],
+                                         (sizeof(szNewDSN) - strlen(psz)) ) )
+               {
+                _iodbcdm_getkeyvalbydsn( dsn, SQL_NTS,
+                                         "UID", (char FAR*) &szNewDSN[strlen(psz)],
+                                         (sizeof(szNewDSN) - strlen(psz)) );
+               }
+                strcat( szNewDSN, ";PWD=" );
+                psz = strtok( szNewDSN, "\0" );
+       if(NULL ==  _iodbcdm_getkeyvalinstr( szConnStrIn, cbConnStrIn,
+                                        /*
+                                         "PWD", psz, sizeof(szNewDSN) ))
+                                        */
+                                         "PWD", (char FAR*) &szNewDSN[strlen(psz)],
+                                         (sizeof(szNewDSN) - strlen(psz)) ) )
+               {
 
+                _iodbcdm_getkeyvalbydsn( dsn, SQL_NTS,
+                                         "PWD", (char FAR*) &szNewDSN[strlen(psz)],
+                                         (sizeof(szNewDSN) - strlen(psz)) );
+               }
+/*
+new from dirk
+       {
+                register char   *psz;
+
+                strcat( szNewDSN, ";UID=" );
+                psz = strtok( szNewDSN, "\0" );
+                _iodbcdm_getkeyvalinstr( szConnStrIn, cbConnStrIn,
+                                         "UID", psz, sizeof(szNewDSN) );
+                strcat( szNewDSN, ";PWD=" );
+                psz = strtok( szNewDSN, "\0" );
+                _iodbcdm_getkeyvalinstr( szConnStrIn, cbConnStrIn,
+                                         "PWD", psz, sizeof(szNewDSN) );
+                szConnStrIn = &szNewDSN[0];
+                cbConnStrIn = SQL_NTS;
+        }
+
+
+*/
+       /******** giovanni & monty ********/
+       /* Add a lot of optional keywords */
+       {
+         static char *keywords[]= { "SERVER","PORT","SOCKET","OPTION","DB",0 };
+         char buff[80],**key,*end;
+
+         psz= szNewDSN+strlen(szNewDSN);
+         end= szNewDSN+sizeof(szNewDSN);
+         for (key=keywords ; *key ; key++)
+         {
+           if (_iodbcdm_getkeyvalbydsn(dsn, SQL_NTS,
+                                       *key, (char FAR*) buff,
+                                       sizeof(buff)) &&
+               strlen(*key)+strlen(buff)+2 < (int) (end - psz))
+           {
+             *psz++=';';
+             strcpy(psz,*key); psz+=strlen(*key);
+             *psz++='=';
+             strcpy(psz,buff); psz+=strlen(buff);            
+           }
+         }
+       }
+       *psz=0;
+       /******** giovanni */
+       szConnStrIn = szNewDSN;  /*giovanni, era &szNewDSN */
+       cbConnStrIn = SQL_NTS;
+        }
+ /* giovanni */
+        CALL_DRIVER ( hdbc, retcode, hproc, en_DriverConnect, (
+                        pdbc->dhdbc, hwnd,
+                        szConnStrIn, cbConnStrIn,
+                        szConnStrOut, cbConnStrOutMax,
+                        pcbConnStrOut, fDriverCompletion ) )
 #if 0
-       retcode = hproc(pdbc->dhdbc, hwnd,
-                       szConnStrIn, cbConnStrIn,
-                       szConnStrOut, cbConnStrOutMax,
-                       pcbConnStrOut, fDriverCompletion );
+        retcode = hproc(pdbc->dhdbc, hwnd,
+                        szConnStrIn, cbConnStrIn,
+                        szConnStrOut, cbConnStrOutMax,
+                        pcbConnStrOut, fDriverCompletion );
 #endif
 
-       if( retcode != SQL_SUCCESS 
-        && retcode != SQL_SUCCESS_WITH_INFO )
-       {
-               /* don't unload driver here for retrive 
-                * error message from driver */
-               /********
-               _iodbcdm_driverunload( hdbc );
-               *********/
+        if( retcode != SQL_SUCCESS
+         && retcode != SQL_SUCCESS_WITH_INFO )
+        {
+                /* don't unload driver here for retrive
+                 * error message from driver */
+                /********
+                _iodbcdm_driverunload( hdbc );
+                *********/
 
-               return retcode;
-       }
+                return retcode;
+        }
 
-       /* state transition */
-       pdbc->state = en_dbc_connected;
+        /* state transition */
+        pdbc->state = en_dbc_connected;
 
-       /* do delaid option setting */
-       setopterr |= _iodbcdm_dbcdelayset( hdbc );
+        /* do delaid option setting */
+        setopterr |= _iodbcdm_dbcdelayset( hdbc );
 
-       if( setopterr != SQL_SUCCESS )
-       {
-               return SQL_SUCCESS_WITH_INFO;
-       }
+        if( setopterr != SQL_SUCCESS )
+        {
+                return SQL_SUCCESS_WITH_INFO;
+        }
 
-       return retcode;
+        return retcode;
 }
 
-RETCODE SQL_API        SQLBrowseConnect ( 
-                       HDBC            hdbc,
-                       HWND            hwnd,
-                       UCHAR FAR*      szConnStrIn,
-                       SWORD           cbConnStrIn,
-                       UCHAR FAR*      szConnStrOut,
-                       SWORD           cbConnStrOutMax,
-                       SWORD FAR*      pcbConnStrOut )
+RETCODE SQL_API SQLBrowseConnect (
+                        HDBC            hdbc,
+                        HWND            hwnd,
+                        UCHAR FAR*      szConnStrIn,
+                        SWORD           cbConnStrIn,
+                        UCHAR FAR*      szConnStrOut,
+                        SWORD           cbConnStrOutMax,
+                        SWORD FAR*      pcbConnStrOut )
 {
-       DBC_t FAR*      pdbc    = (DBC_t FAR*)hdbc;
-/*     HDLL            hdll; */
-       char  FAR*      drv;
-       char            drvbuf[1024];
-       char  FAR*      dsn;
-       char            dsnbuf[SQL_MAX_DSN_LENGTH + 1];
-/*     UCHAR           cnstr2drv[1024]; */
-
-       HPROC           hproc /*, dialproc*/ ;
-
-/*     int             sqlstat = en_00000; */
-       RETCODE         retcode = SQL_SUCCESS;
-       RETCODE         setopterr = SQL_SUCCESS;
-
-       if( hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       /* check arguments */
-       if( ( cbConnStrIn < 0 && cbConnStrIn != SQL_NTS )
-        || cbConnStrOutMax < 0 )
-       {
-               PUSHSQLERR (pdbc->herr, en_S1090 );
-
-               return SQL_ERROR;
-       }
-
-       if( pdbc->state == en_dbc_allocated )
-       {
-               drv = _iodbcdm_getkeyvalinstr(szConnStrIn, cbConnStrIn, 
-                               "DRIVER", drvbuf, sizeof(drvbuf));
-       
-               dsn = _iodbcdm_getkeyvalinstr(szConnStrIn, cbConnStrIn,
-                               "DSN",    dsnbuf, sizeof(dsnbuf));
-       
-               if( dsn == NULL || dsn[0] == '\0' )
-               {
-                       dsn = "default";
-               }
-               else    /* if you want tracing, you must use a DSN */
-               {
-                       setopterr |= _iodbcdm_settracing( hdbc, 
-                                               (char*)dsn, SQL_NTS );
-               }
-       
-               if( drv == NULL || drv[0] == '\0' )
-               {
-                       drv = _iodbcdm_getkeyvalbydsn( dsn, SQL_NTS, "Driver", 
-                                               drvbuf, sizeof(drvbuf));
-               }
-       
-               if( drv == NULL )
-               {
-                       PUSHSQLERR( pdbc->herr, en_IM002 );
-       
-                       return SQL_ERROR;
-               }
-       
-               retcode = _iodbcdm_driverload( drv, hdbc );
-       
-               switch( retcode )
-               {
-                       case SQL_SUCCESS:
-                               break;
-       
-                       case SQL_SUCCESS_WITH_INFO:
-                               setopterr = SQL_ERROR;
-                               /* unsuccessed in calling driver's 
-                                * SQLSetConnectOption() to set login
-                                * timeout.
-                                */
-                               break;
-       
-                       default:
-                               return retcode;
-               }
-       }
-       else if( pdbc->state != en_dbc_needdata )
-       {
-               PUSHSQLERR ( pdbc->herr, en_08002 );
-
-               return SQL_ERROR;
-       }
-
-       hproc = _iodbcdm_getproc( hdbc, en_BrowseConnect);
-
-       if( hproc == SQL_NULL_HPROC )
-       {
-               _iodbcdm_driverunload( hdbc );
-
-               pdbc->state = en_dbc_allocated;
-
-               PUSHSQLERR( pdbc->herr, en_IM001 );
+        DBC_t FAR*      pdbc    = (DBC_t FAR*)hdbc;
+        HDLL            hdll;
+        char  FAR*      drv;
+        char            drvbuf[1024];
+        char  FAR*      dsn;
+        char            dsnbuf[SQL_MAX_DSN_LENGTH + 1];
+        UCHAR           cnstr2drv[1024];
+
+        HPROC           hproc, dialproc;
+
+        int             sqlstat = en_00000;
+        RETCODE         retcode = SQL_SUCCESS;
+        RETCODE         setopterr = SQL_SUCCESS;
+
+        if( hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        /* check arguments */
+        if( ( cbConnStrIn < 0 && cbConnStrIn != SQL_NTS )
+         || cbConnStrOutMax < 0 )
+        {
+                PUSHSQLERR (pdbc->herr, en_S1090 );
+
+                return SQL_ERROR;
+        }
+
+        if( pdbc->state == en_dbc_allocated )
+        {
+                drv = _iodbcdm_getkeyvalinstr(szConnStrIn, cbConnStrIn,
+                                "DRIVER", drvbuf, sizeof(drvbuf));
+
+                dsn = _iodbcdm_getkeyvalinstr(szConnStrIn, cbConnStrIn,
+                                "DSN",    dsnbuf, sizeof(dsnbuf));
+
+                if( dsn == NULL || dsn[0] == '\0' )
+                {
+                        dsn = "default";
+                }
+                else    /* if you want tracing, you must use a DSN */
+                {
+                        setopterr |= _iodbcdm_settracing( hdbc,
+                                                (char*)dsn, SQL_NTS );
+                }
+
+                if( drv == NULL || drv[0] == '\0' )
+                {
+                        drv = _iodbcdm_getkeyvalbydsn( dsn, SQL_NTS, "Driver",
+                                                drvbuf, sizeof(drvbuf));
+                }
+
+                if( drv == NULL )
+                {
+                        PUSHSQLERR( pdbc->herr, en_IM002 );
+
+                        return SQL_ERROR;
+                }
+
+                retcode = _iodbcdm_driverload( drv, hdbc );
+
+                switch( retcode )
+                {
+                        case SQL_SUCCESS:
+                                break;
+
+                        case SQL_SUCCESS_WITH_INFO:
+                                setopterr = SQL_ERROR;
+                                /* unsuccessed in calling driver's
+                                 * SQLSetConnectOption() to set login
+                                 * timeout.
+                                 */
+                                break;
+
+                        default:
+                                return retcode;
+                }
+        }
+        else if( pdbc->state != en_dbc_needdata )
+        {
+                PUSHSQLERR ( pdbc->herr, en_08002 );
+
+                return SQL_ERROR;
+        }
+
+        hproc = _iodbcdm_getproc( hdbc, en_BrowseConnect);
+
+        if( hproc == SQL_NULL_HPROC )
+        {
+                _iodbcdm_driverunload( hdbc );
+
+                pdbc->state = en_dbc_allocated;
+
+                PUSHSQLERR( pdbc->herr, en_IM001 );
+
+                return SQL_ERROR;
+        }
+
+        CALL_DRIVER ( hdbc, retcode, hproc, en_BrowseConnect, (
+                        pdbc->dhdbc, hwnd,
+                        szConnStrIn, cbConnStrIn,
+                        szConnStrOut, cbConnStrOutMax,
+                        pcbConnStrOut ) )
 
-               return SQL_ERROR;
-       }
-
-       CALL_DRIVER ( hdbc, retcode, hproc, en_BrowseConnect, (
-                       pdbc->dhdbc, hwnd,
-                       szConnStrIn, cbConnStrIn,
-                       szConnStrOut, cbConnStrOutMax,
-                       pcbConnStrOut ) )
-
-#if 0 
-       retcode = hproc(pdbc->dhdbc, hwnd,
-                       szConnStrIn, cbConnStrIn,
-                       szConnStrOut, cbConnStrOutMax,
-                       pcbConnStrOut );
+#if 0
+        retcode = hproc(pdbc->dhdbc, hwnd,
+                        szConnStrIn, cbConnStrIn,
+                        szConnStrOut, cbConnStrOutMax,
+                        pcbConnStrOut );
 #endif
 
-       switch( retcode )
-       {
-               case SQL_SUCCESS: 
-               case SQL_SUCCESS_WITH_INFO:
-                       pdbc->state = en_dbc_connected;
-                       setopterr |= _iodbcdm_dbcdelayset( hdbc );
-                       if( setopterr != SQL_SUCCESS )
-                       {
-                               retcode = SQL_SUCCESS_WITH_INFO;
-                       }
-                       break;
-
-               case SQL_NEED_DATA:
-                       pdbc->state = en_dbc_needdata;
-                       break;
-
-               case SQL_ERROR:
-                       pdbc->state = en_dbc_allocated;
-                       /* but the driver will not unloaded 
-                        * to allow application retrive err
-                        * message from driver 
-                        */
-                       break;
-
-               default:
-                       break;
-       }
-
-       return retcode;
+        switch( retcode )
+        {
+                case SQL_SUCCESS:
+                case SQL_SUCCESS_WITH_INFO:
+                        pdbc->state = en_dbc_connected;
+                        setopterr |= _iodbcdm_dbcdelayset( hdbc );
+                        if( setopterr != SQL_SUCCESS )
+                        {
+                                retcode = SQL_SUCCESS_WITH_INFO;
+                        }
+                        break;
+
+                case SQL_NEED_DATA:
+                        pdbc->state = en_dbc_needdata;
+                        break;
+
+                case SQL_ERROR:
+                        pdbc->state = en_dbc_allocated;
+                        /* but the driver will not unloaded
+                         * to allow application retrive err
+                         * message from driver
+                         */
+                        break;
+
+                default:
+                        break;
+        }
+
+        return retcode;
 }
 
-RETCODE SQL_API        SQLDisconnect ( HDBC hdbc )
+RETCODE SQL_API SQLDisconnect ( HDBC hdbc )
 {
-       DBC_t   FAR*    pdbc    = (DBC_t*)hdbc;
-       STMT_t  FAR*    pstmt;
-       RETCODE         retcode;
-       HPROC           hproc;
-
-       int             sqlstat = en_00000;
-
-       if( hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       /* check hdbc state */
-       if ( pdbc->state == en_dbc_allocated )
-       {
-               sqlstat = en_08003;
-       }
-
-       /* check stmt(s) state */
-       for( pstmt  = (STMT_t FAR*)pdbc->hstmt;
-            pstmt != NULL && sqlstat == en_00000;
-            pstmt  = (STMT_t FAR*)pstmt->next )
-       {
-               if( pstmt->state >= en_stmt_needdata 
-                || pstmt->asyn_on != en_NullProc )
-               /* In this case one need to call 
-                * SQLCancel() first */
-               {
-                       sqlstat = en_S1010;
-               }
-       }
-
-       if( sqlstat == en_00000 )
-       {
-               hproc = _iodbcdm_getproc( hdbc, en_Disconnect );
-
-               if( hproc == SQL_NULL_HPROC )
-               {
-                       sqlstat = en_IM001;
-               }
-       }
-
-       if( sqlstat != en_00000 )
-       {
-               PUSHSQLERR ( pdbc->herr, sqlstat );
-
-               return SQL_ERROR;
-       }
-       
-       CALL_DRIVER ( hdbc, retcode, hproc, en_Disconnect, (
-                       pdbc->dhdbc ) )
+        DBC_t   FAR*    pdbc    = (DBC_t*)hdbc;
+        STMT_t  FAR*    pstmt;
+        RETCODE         retcode;
+        HPROC           hproc;
+
+        int             sqlstat = en_00000;
+
+        if( hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        /* check hdbc state */
+        if ( pdbc->state == en_dbc_allocated )
+        {
+                sqlstat = en_08003;
+        }
+
+        /* check stmt(s) state */
+        for( pstmt  = (STMT_t FAR*)pdbc->hstmt;
+             pstmt != NULL && sqlstat == en_00000;
+             pstmt  = (STMT_t FAR*)pstmt->next )
+        {
+                if( pstmt->state >= en_stmt_needdata
+                 || pstmt->asyn_on != en_NullProc )
+                /* In this case one need to call
+                 * SQLCancel() first */
+                {
+                        sqlstat = en_S1010;
+                }
+        }
+
+        if( sqlstat == en_00000 )
+        {
+                hproc = _iodbcdm_getproc( hdbc, en_Disconnect );
+
+                if( hproc == SQL_NULL_HPROC )
+                {
+                        sqlstat = en_IM001;
+                }
+        }
+
+        if( sqlstat != en_00000 )
+        {
+                PUSHSQLERR ( pdbc->herr, sqlstat );
+
+                return SQL_ERROR;
+        }
+
+        CALL_DRIVER ( hdbc, retcode, hproc, en_Disconnect, (
+                        pdbc->dhdbc ) )
 
 #if 0
-       retcode = hproc( pdbc->dhdbc );
+        retcode = hproc( pdbc->dhdbc );
 #endif
 
-       if( retcode == SQL_SUCCESS
-        || retcode == SQL_SUCCESS_WITH_INFO )
-       {
-               /* diff from MS specs. We disallow
-                * driver SQLDisconnect() return
-                * SQL_SUCCESS_WITH_INFO and post
-                * error message.
-                */
-               retcode = SQL_SUCCESS;
-       }
-       else
-       {
-               return retcode;
-       }
-
-       /* free all statement handle(s) on this connection */
-       for(;pdbc->hstmt;)
-       {
-               _iodbcdm_dropstmt( pdbc->hstmt );
-       }
+        if( retcode == SQL_SUCCESS
+         || retcode == SQL_SUCCESS_WITH_INFO )
+        {
+                /* diff from MS specs. We disallow
+                 * driver SQLDisconnect() return
+                 * SQL_SUCCESS_WITH_INFO and post
+                 * error message.
+                 */
+                retcode = SQL_SUCCESS;
+        }
+        else
+        {
+                return retcode;
+        }
+
+        /* free all statement handle(s) on this connection */
+        for(;pdbc->hstmt;)
+        {
+                _iodbcdm_dropstmt( pdbc->hstmt );
+        }
 
 #if 0
-       retcode = _iodbcdm_driverunload( hdbc );
+        retcode = _iodbcdm_driverunload( hdbc );
 #endif
 
-       /* state transition */
-       if( retcode == SQL_SUCCESS )
-       {
-               pdbc->state = en_dbc_allocated;
-       }
+        /* state transition */
+        if( retcode == SQL_SUCCESS )
+        {
+                pdbc->state = en_dbc_allocated;
+        }
 
-       return retcode;
+        return retcode;
 }
 
-RETCODE SQL_API        SQLNativeSql(
-                       HDBC            hdbc,
-                       UCHAR  FAR*     szSqlStrIn,
-                       SDWORD          cbSqlStrIn,
-                       UCHAR  FAR*     szSqlStr,
-                       SDWORD          cbSqlStrMax,
-                       SDWORD FAR*     pcbSqlStr )
+RETCODE SQL_API SQLNativeSql(
+                        HDBC            hdbc,
+                        UCHAR  FAR*     szSqlStrIn,
+                        SDWORD          cbSqlStrIn,
+                        UCHAR  FAR*     szSqlStr,
+                        SDWORD          cbSqlStrMax,
+                        SDWORD FAR*     pcbSqlStr )
 {
-       DBC_t FAR*      pdbc    = (DBC_t FAR*)hdbc;
-       HPROC           hproc;
-       int             sqlstat = en_00000;
-       RETCODE         retcode;
-       
-       if( hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       /* check argument */
-       if( szSqlStrIn == NULL )
-       {
-               sqlstat = en_S1009;
-       }
-       else if( cbSqlStrIn < 0
-             && cbSqlStrIn != SQL_NTS )
-       {
-               sqlstat = en_S1090;
-       }
-
-       if( sqlstat != en_00000 )
-       {
-               PUSHSQLERR ( pdbc->herr, sqlstat );
-
-               return SQL_ERROR;
-       }
-
-       /* check state */
-       if( pdbc->state <= en_dbc_needdata )
-       {
-               PUSHSQLERR ( pdbc->herr, en_08003 );
-
-               return SQL_ERROR;
-       }
-
-       /* call driver */
-       hproc = _iodbcdm_getproc( hdbc, en_NativeSql );
-
-       if( hproc == SQL_NULL_HPROC )
-       {
-               PUSHSQLERR ( pdbc->herr, en_IM001 );
-
-               return SQL_ERROR;
-       }
-
-       CALL_DRIVER ( hdbc, retcode, hproc, en_NativeSql, (
-                       pdbc->dhdbc,
-                       szSqlStrIn,
-                       cbSqlStrIn,
-                       szSqlStr,
-                       cbSqlStrMax,
-                       pcbSqlStr ) )
+        DBC_t FAR*      pdbc    = (DBC_t FAR*)hdbc;
+        HPROC           hproc;
+        int             sqlstat = en_00000;
+        RETCODE         retcode;
+
+        if( hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        /* check argument */
+        if( szSqlStrIn == NULL )
+        {
+                sqlstat = en_S1009;
+        }
+        else if( cbSqlStrIn < 0
+              && cbSqlStrIn != SQL_NTS )
+        {
+                sqlstat = en_S1090;
+        }
+
+        if( sqlstat != en_00000 )
+        {
+                PUSHSQLERR ( pdbc->herr, sqlstat );
+
+                return SQL_ERROR;
+        }
+
+        /* check state */
+        if( pdbc->state <= en_dbc_needdata )
+        {
+                PUSHSQLERR ( pdbc->herr, en_08003 );
+
+                return SQL_ERROR;
+        }
+
+        /* call driver */
+        hproc = _iodbcdm_getproc( hdbc, en_NativeSql );
+
+        if( hproc == SQL_NULL_HPROC )
+        {
+                PUSHSQLERR ( pdbc->herr, en_IM001 );
+
+                return SQL_ERROR;
+        }
+
+        CALL_DRIVER ( hdbc, retcode, hproc, en_NativeSql, (
+                        pdbc->dhdbc,
+                        szSqlStrIn,
+                        cbSqlStrIn,
+                        szSqlStr,
+                        cbSqlStrMax,
+                        pcbSqlStr ) )
 
 #if 0
-       retcode = hproc(pdbc->dhdbc,
-                       szSqlStrIn,
-                       cbSqlStrIn,
-                       szSqlStr,
-                       cbSqlStrMax,
-                       pcbSqlStr );
+        retcode = hproc(pdbc->dhdbc,
+                        szSqlStrIn,
+                        cbSqlStrIn,
+                        szSqlStr,
+                        cbSqlStrMax,
+                        pcbSqlStr );
 #endif
 
-       return retcode;
+        return retcode;
 }
index 5745f8f07e7b34e079e21caf7c871b4042267ba5..9c5ed6427214fe8270d64d9e55ca7e9142954dac 100644 (file)
@@ -1,6 +1,6 @@
 /** dynamic library loader (mapping to svr4)
-    Copyright (C) 1995 by Ke Jin <kejin@empress.com> 
+
+    Copyright (C) 1995 by Ke Jin <kejin@empress.com>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     GNU General Public License for more details.
 **/
 
-#include  "wx/setup.h"
+#ifdef DLDAPI_OS2
+#  define INCL_DOSMODULEMGR                 /* Module Manager values */
+#  define INCL_DOSERRORS                    /* Error values          */
+#  include      <os2.h>
+#  include      <stdio.h>
+#endif
 
+#include  "wx/setup.h"
 #include       <../iodbc/dlf.h>
 #include       <errno.h>
 
-#ifdef DLDAPI_DEFINED  
+#ifdef  DLDAPI_DEFINED
 # undef DLDAPI_DEFINED
 #endif
 
-#ifdef DLDAPI_SVR4_DLFCN
+#ifdef  DLDAPI_SVR4_DLFCN
 # define DLDAPI_DEFINED
-static char sccsid[] = "@(#)dynamic load interface -- SVR4 dlfcn";
+static  char sccsid[] = "@(#)dynamic load interface -- SVR4 dlfcn";
 #endif
 
-/********************************* 
+/*********************************
  *
- *     HP/UX 
+ *      HP/UX
  *
  *********************************/
-#ifdef DLDAPI_HP_SHL
-# define       DLDAPI_DEFINED
-# include      <dl.h>
+#ifdef  DLDAPI_HP_SHL
+# define        DLDAPI_DEFINED
+# include       <dl.h>
 
-static char sccsid[] = "@(#)dynamic load interface -- HP/UX dl(shl)";
+static  char sccsid[] = "@(#)dynamic load interface -- HP/UX dl(shl)";
 
-void*  dlopen(char* path, int mode)
+void*   dlopen(char* path, int mode)
 {
-       return (void*)shl_load((char*)(path), BIND_DEFERRED, 0L);
+        return (void*)shl_load((char*)(path), BIND_DEFERRED, 0L);
 }
 
-void*  dlsym(void* hdll, char* sym)
+void*   dlsym(void* hdll, char* sym)
 {
-       void*   symaddr = 0;
-       int     ret;
+        void*   symaddr = 0;
+        int     ret;
 
-       if( ! hdll )
-               hdll = (void*)PROG_HANDLE;
+        if( ! hdll )
+                hdll = (void*)PROG_HANDLE;
 
-       /* Remember, a driver may export calls as function pointers 
-        * (i.e. with type TYPE_DATA) rather than as functions 
-        * (i.e. with type TYPE_PROCEDURE). Thus, to be safe, we 
-        * uses TYPE_UNDEFINED to cover all of them. 
-        */
-       ret = shl_findsym((shl_t*)&hdll, sym, TYPE_UNDEFINED, &symaddr);
+        /* Remember, a driver may export calls as function pointers
+         * (i.e. with type TYPE_DATA) rather than as functions
+         * (i.e. with type TYPE_PROCEDURE). Thus, to be safe, we
+         * uses TYPE_UNDEFINED to cover all of them.
+         */
+        ret = shl_findsym((shl_t*)&hdll, sym, TYPE_UNDEFINED, &symaddr);
 
-       if( ret == -1 )
-               return 0;
+        if( ret == -1 )
+                return 0;
 
-       return symaddr;
+        return symaddr;
 }
 
-char*  dlerror()
+char*   dlerror()
 {
-       extern char*    strerror();
+        extern char*    strerror();
 
-       return strerror(errno);
+        return strerror(errno);
 }
 
-int    dlclose(void* hdll)
+int     dlclose(void* hdll)
 {
-       return shl_unload((shl_t)hdll);
+        return shl_unload((shl_t)hdll);
 }
 
-#endif /* end of HP/UX Seection */
+#endif  /* end of HP/UX Seection */
 
 /*********************************
  *
- *     IBM AIX
+ *      IBM AIX
  *
  *********************************/
-#ifdef DLDAPI_AIX_LOAD
-# define       DLDAPI_DEFINED
-# include      <sys/types.h>
-# include      <sys/ldr.h>
-# include      <sys/stat.h>
-# include      <nlist.h>
+#ifdef  DLDAPI_AIX_LOAD
+# define        DLDAPI_DEFINED
+# include       <sys/ldr.h>
+# include       <sys/stat.h>
+# include       <nlist.h>
 
 /*
- *   Following id sting is a copyright mark. Removing(i.e. use the 
+ *   Following id sting is a copyright mark. Removing(i.e. use the
  *   source code in this .c file without include it or make it not
- *   appear in the final object file of AIX platform) or modifing 
- *   it without permission from original author(kejin@empress.com) 
+ *   appear in the final object file of AIX platform) or modifing
+ *   it without permission from original author(kejin@empress.com)
  *   are copyright violation.
  */
 static  char sccsid[]
-       = "@(#)dynamic load interface, Copyright(c) 1995 by Ke Jin";
+        = "@(#)dynamic load interface, Copyright(c) 1995 by Ke Jin";
 
-# ifndef       HTAB_SIZE
-#  define      HTAB_SIZE       256
+# ifndef        HTAB_SIZE
+#  define       HTAB_SIZE       256
 # endif
 
-# define       FACTOR          0.618039887 /* i.e. (sqrt(5) - 1)/2 */
+# define        FACTOR          0.618039887 /* i.e. (sqrt(5) - 1)/2 */
 
-# ifndef       ENTRY_SYM
-#  define      ENTRY_SYM       ".__start" /* default entry point for aix */
+# ifndef        ENTRY_SYM
+#  define       ENTRY_SYM       ".__start" /* default entry point for aix */
 # endif
 
 typedef struct slot_s
 {
-       char*           sym;
-       long            fdesc[3]; /* 12 bytes function descriptor */
-       struct slot_s*  next;
+        char*           sym;
+        long            fdesc[3]; /* 12 bytes function descriptor */
+        struct slot_s*  next;
 } slot_t;
 
 /* Note: on AIX, a function pointer actually points to a
  * function descriptor, a 12 bytes data. The first 4 bytes
- * is the virtual address of the function. The next 4 bytes 
+ * is the virtual address of the function. The next 4 bytes
  * is the virtual address of TOC (Table of Contents) of the
- * object module the function belong to. The last 4 bytes 
- * are always 0 for C and Fortran functions. Every object 
+ * object module the function belong to. The last 4 bytes
+ * are always 0 for C and Fortran functions. Every object
  * module has an entry point (which can be specified at link
  * time by -e ld option). iODBC driver manager requires ODBC
  * driver shared library always use the default entry point
  * (so you shouldn't use -e ld option when creating a driver
- * share library). load() returns the function descriptor of 
+ * share library). load() returns the function descriptor of
  * a module's entry point. From which we can calculate function
  * descriptors of other functions in the same module by using
- * the fact that the load() doesn't change the relative 
- * offset of functions to their module entry point(i.e the 
- * offset in memory loaded by load() will be as same as in 
- * the module library file). 
+ * the fact that the load() doesn't change the relative
+ * offset of functions to their module entry point(i.e the
+ * offset in memory loaded by load() will be as same as in
+ * the module library file).
  */
 
-typedef        slot_t*         hent_t;
-typedef struct nlist   nlist_t;
-typedef struct stat    stat_t; 
+typedef slot_t*         hent_t;
+typedef struct nlist    nlist_t;
+typedef struct stat     stat_t;
 
-typedef struct obj 
+typedef struct obj
 {
-       int     dev;    /* device id */
-       int     ino;    /* inode number */
-       char*   path;   /* file name */
-       int     (*pentry)();    /* entry point of this share library */
-       int     refn;   /* number of reference */
-       hent_t  htab[HTAB_SIZE];
-       struct obj*
-               next;
+        int     dev;    /* device id */
+        int     ino;    /* inode number */
+        char*   path;   /* file name */
+        int     (*pentry)();    /* entry point of this share library */
+        int     refn;   /* number of reference */
+        hent_t  htab[HTAB_SIZE];
+        struct obj*
+                next;
 } obj_t;
 
-static char*   errmsg = 0;
+static char*    errmsg = 0;
 
 static void init_htab(hent_t* ht)
 /* initate a hashing table */
 {
-       int     i;
+        int     i;
 
-       for(i=0; i<HTAB_SIZE; i++)
-               ht[i] = (slot_t*)0;
+        for(i=0; i<HTAB_SIZE; i++)
+                ht[i] = (slot_t*)0;
 
-       return;
+        return;
 }
 
 static void clean_htab(hent_t* ht)
 /* free all slots */
 {
-       int     i;
-       slot_t* ent;
-       slot_t* tent;
-
-       for(i = 0; i< HTAB_SIZE; i++)
-       {
-               for( ent = ht[i]; ent; )
-               {
-                       tent = ent->next;
-                       
-                       free(ent->sym);
-                       free(ent);
-
-                       ent = tent;
-               }
-
-               ht[i] = 0;
-       }
-
-       return;
+        int     i;
+        slot_t* ent;
+        slot_t* tent;
+
+        for(i = 0; i< HTAB_SIZE; i++)
+        {
+                for( ent = ht[i]; ent; )
+                {
+                        tent = ent->next;
+
+                        free(ent->sym);
+                        free(ent);
+
+                        ent = tent;
+                }
+
+                ht[i] = 0;
+        }
+
+        return;
 }
 
-static int     hash(char* sym )
+static int      hash(char* sym )
 {
-       int     a, key;
-       double  f;
+        int     a, key;
+        double  f;
 
-       if( !sym || !*sym )
-               return 0;
+        if( !sym || !*sym )
+                return 0;
 
-       for(key=*sym;*sym;sym++)
+        for(key=*sym;*sym;sym++)
         {
-               key += *sym;
+                key += *sym;
                 a = key;
 
-               key = (int)( (a<<8) + (key>>8) );
-               key = (key>0)? key:-key;
+                key = (int)( (a<<8) + (key>>8) );
+                key = (key>0)? key:-key;
         }
 
-       f = key*FACTOR;
-       a = (int)f;
+        f = key*FACTOR;
+        a = (int)f;
 
-       return (int)((HTAB_SIZE - 1)*( f - a ));
+        return (int)((HTAB_SIZE - 1)*( f - a ));
 }
 
-static hent_t  search(hent_t* htab, char* sym)
+static hent_t   search(hent_t* htab, char* sym)
 /* search hashing table to find a matched slot */
 {
-       int     key;
-       slot_t* ent;
+        int     key;
+        slot_t* ent;
 
-       key = hash(sym);
+        key = hash(sym);
 
-       for(ent = htab[key]; ent; ent = ent->next )
-       {
-               if(!strcmp(ent->sym, sym))
-                       return ent;
-       }
+        for(ent = htab[key]; ent; ent = ent->next )
+        {
+                if(!strcmp(ent->sym, sym))
+                        return ent;
+        }
 
-       return 0;       /* no match */
+        return 0;       /* no match */
 }
 
-static void    insert(hent_t* htab, slot_t* ent)
+static void     insert(hent_t* htab, slot_t* ent)
 /* insert a new slot to hashing table */
 {
-       int     key;
+        int     key;
 
-       key = hash(ent->sym);
+        key = hash(ent->sym);
 
-       ent->next = htab[key];
-       htab[key] = ent;
+        ent->next = htab[key];
+        htab[key] = ent;
 
-       return;
+        return;
 }
 
-static slot_t* slot_alloc(char* sym)
+static slot_t*  slot_alloc(char* sym)
 /* allocate a new slot with symbol */
 {
-       slot_t* ent;
+        slot_t* ent;
 
-       ent = (slot_t*)malloc(sizeof(slot_t));
+        ent = (slot_t*)malloc(sizeof(slot_t));
 
-       ent->sym = (char*)malloc(strlen(sym)+1);
+        ent->sym = (char*)malloc(strlen(sym)+1);
 
-       if( ! ent->sym )
-       {
-               free(ent);
-               return 0;
-       }
+        if( ! ent->sym )
+        {
+                free(ent);
+                return 0;
+        }
 
-       strcpy( ent->sym, sym );
+        strcpy( ent->sym, sym );
 
-       return ent;
+        return ent;
 }
 
 static obj_t* obj_list = 0;
 
-void*  dlopen(char* file, int mode )
+void*   dlopen(char* file, int mode )
 {
-       stat_t  st;
-       obj_t*  pobj;
-       char    buf[1024];
-       
-       if( ! file || ! *file )
-       {
-               errno = EINVAL;
-               return 0;
-       }
-
-       errno = 0;
-       errmsg = 0;
+        stat_t  st;
+        obj_t*  pobj;
+        char    buf[1024];
+
+        if( ! file || ! *file )
+        {
+                errno = EINVAL;
+                return 0;
+        }
+
+        errno = 0;
+        errmsg = 0;
 
 #if 0
-       if( file[0] != '/' && file[0] != '.' )
-       {
-               for(;;)
-               {
-                       sprintf(buf, "/lib/%s", file);
-
-                       if( stat( buf, &st ) )
-                       {
-                               file = buf;
-                               break;
-                       }
-                       
-                       sprintf(buf, "/usr/lib/%s", file);
-
-                       if( stat( buf, &st ) )
-                       {
-                               file = buf;
-                               break; 
-                       }
-
-                       if( stat( file, &st ) )
-                               break;
-
-                       return 0;
-               }
-       }
-       else 
+        if( file[0] != '/' && file[0] != '.' )
+        {
+                for(;;)
+                {
+                        sprintf(buf, "/lib/%s", file);
+
+                        if( stat( buf, &st ) )
+                        {
+                                file = buf;
+                                break;
+                        }
+
+                        sprintf(buf, "/usr/lib/%s", file);
+
+                        if( stat( buf, &st ) )
+                        {
+                                file = buf;
+                                break;
+                        }
+
+                        if( stat( file, &st ) )
+                                break;
+
+                        return 0;
+                }
+        }
+        else
 #endif
-       if( stat( file, &st ) )
-               return 0;
+        if( stat( file, &st ) )
+                return 0;
 
-       for( pobj = obj_list; pobj; pobj = pobj->next )
-       /* find a match object */
-       {
-               if( pobj->ino == st.st_ino 
-                && pobj->dev == st.st_dev )
-               {
-                       /* found a match. increase its
-                        * reference count and return 
-                        * its address */
-                       pobj->refn ++;
-                       return pobj;
-               }
-       }
+        for( pobj = obj_list; pobj; pobj = pobj->next )
+        /* find a match object */
+        {
+                if( pobj->ino == st.st_ino
+                 && pobj->dev == st.st_dev )
+                {
+                        /* found a match. increase its
+                         * reference count and return
+                         * its address */
+                        pobj->refn ++;
+                        return pobj;
+                }
+        }
 
-       pobj = (obj_t*)malloc( sizeof(obj_t) );
+        pobj = (obj_t*)malloc( sizeof(obj_t) );
 
-       if( ! pobj )
-               return 0;
+        if( ! pobj )
+                return 0;
 
-       pobj->path = (char*)malloc( strlen(file) + 1);
+        pobj->path = (char*)malloc( strlen(file) + 1);
 
-       if( ! pobj->path )
-       {
-               free( pobj );
-               return 0;
-       }
+        if( ! pobj->path )
+        {
+                free( pobj );
+                return 0;
+        }
 
-       strcpy( pobj->path, file );
+        strcpy( pobj->path, file );
 
-       pobj->dev = st.st_dev;
-       pobj->ino = st.st_ino;
-       pobj->refn = 1;
+        pobj->dev = st.st_dev;
+        pobj->ino = st.st_ino;
+        pobj->refn = 1;
 
-       pobj->pentry = (int(*)())load(file, 0, 0);
+        pobj->pentry = (int(*)())load(file, 0, 0);
 
-       if( ! pobj->pentry )
-       {
-               free( pobj->path );
-               free( pobj );
-               return 0;
-       }
+        if( ! pobj->pentry )
+        {
+                free( pobj->path );
+                free( pobj );
+                return 0;
+        }
 
-       init_htab(pobj->htab);
+        init_htab(pobj->htab);
 
-       pobj->next = obj_list;
-       obj_list = pobj;
+        pobj->next = obj_list;
+        obj_list = pobj;
 
-       return pobj;
+        return pobj;
 }
 
-int    dlclose(void* hobj)
+int     dlclose(void* hobj)
 {
-       obj_t*  pobj = (obj_t*)hobj;
-       obj_t*  tpobj;
-       int     match = 0;
-
-       if( ! hobj )
-       {
-               errno = EINVAL;
-               return -1;
-       }
-
-       errno = 0;
-       errmsg = 0;
-
-       if( pobj == obj_list )
-       {
-               pobj->refn --;
-
-               if( pobj->refn )
-                       return 0;
-
-               match = 1;
-               obj_list = pobj->next;
-       }
-
-       for( tpobj = obj_list; !match && tpobj; tpobj = tpobj->next )
-       {
-               if( tpobj->next == pobj )
-               {
-                       pobj->refn --;
-
-                       if( pobj->refn )
-                               return 0;
-
-                       match = 1;
-                       tpobj->next = pobj->next;
-               }
-       }
-
-       if(match)
-       {
-               unload((void*)(pobj->pentry));
-               clean_htab(pobj->htab);
-               free(pobj->path);
-               free(pobj);
-       }
-
-       return 0;
+        obj_t*  pobj = (obj_t*)hobj;
+        obj_t*  tpobj;
+        int     match = 0;
+
+        if( ! hobj )
+        {
+                errno = EINVAL;
+                return -1;
+        }
+
+        errno = 0;
+        errmsg = 0;
+
+        if( pobj == obj_list )
+        {
+                pobj->refn --;
+
+                if( pobj->refn )
+                        return 0;
+
+                match = 1;
+                obj_list = pobj->next;
+        }
+
+        for( tpobj = obj_list; !match && tpobj; tpobj = tpobj->next )
+        {
+                if( tpobj->next == pobj )
+                {
+                        pobj->refn --;
+
+                        if( pobj->refn )
+                                return 0;
+
+                        match = 1;
+                        tpobj->next = pobj->next;
+                }
+        }
+
+        if(match)
+        {
+                unload((void*)(pobj->pentry));
+                clean_htab(pobj->htab);
+                free(pobj->path);
+                free(pobj);
+        }
+
+        return 0;
 }
 
-char*  dlerror()
+char*   dlerror()
 {
-       extern char*    sys_errlist[];
+        extern char*    sys_errlist[];
 
-       if( ! errmsg || ! errmsg[0] )
-       {
-               if( errno >= 0 )
-                       return sys_errlist[errno];
-               
-               return "";
-       }
+        if( ! errmsg || ! errmsg[0] )
+        {
+                if( errno >= 0 )
+                        return sys_errlist[errno];
+
+                return "";
+        }
 
-       return errmsg;
+        return errmsg;
 }
 
-void*  dlsym(void* hdl, char* sym)
+void*   dlsym(void* hdl, char* sym)
 {
-       nlist_t nl[3];
-       obj_t*  pobj = (obj_t*)hdl;
-       slot_t* ent;
-       int     (*fp)();
-       long    lbuf[3];
-
-       if( !hdl || !(pobj->htab) || !sym || ! *sym )
-       {
-               errno = EINVAL;
-               return 0;
-       }
-
-       errno = 0;
-       errmsg = 0;
-
-       ent = search( pobj->htab, sym );
-
-       if( ent )
-               return ent->fdesc;
-
-#define        n_name  _n._n_name
-
-       nl[0].n_name = ENTRY_SYM;
-       nl[1].n_name = sym;
-       nl[2].n_name = 0;
-
-       /* There is a potential problem here. If application
-        * did not pass a full path name, and changed the
-        * working directory after the load(), then nlist()
-        * will be unable to open the original shared library
-        * file to resolve the symbols. there are 3 ways to working 
-        * round this: 1. convert to full pathname in driver
-        * manager. 2. applications always pass driver's full 
-        * path name. 3. if driver itself don't support 
-        * SQLGetFunctions(), call it with SQL_ALL_FUNCTIONS
-        * as flag immidately after SQLConnect(), SQLDriverConnect()
-        * and SQLBrowseConnect() to force the driver manager
-        * resolving all will be used symbols. 
-        */
-       if( nlist( pobj->path, nl) == -1 )
-               return 0;
-
-       if( ! nl[0].n_type && ! nl[0].n_value )
-       {
-               errmsg = "can't locate module entry symbol";
-               return 0;
-       }
-
-       /* Note: On AIX 3.x if the object library is not
-        * built with -g compiling option, .n_type field
-        * is always 0. While on 4.x it will be 32. 
-        * On AIX 4.x, if the symbol is a entry point,
-        * n_value will be 0. However, one thing is for sure 
-        * that if a symbol is not existance in the file,
-        * both .n_type and .n_value would be 0.
-        */
-
-       if( ! nl[1].n_type && ! nl[1].n_value )
-       {
-               errmsg = "symbol not existance in this module";
-               return 0;
-       }
-
-       ent = slot_alloc(sym);
-
-       if( ! ent )
-               return 0;
-
-       /* catch it with a slot in the hashing table */
-       insert(pobj->htab, ent);
-
-       memcpy(ent->fdesc, pobj->pentry, sizeof(ent->fdesc));
-
-       /* now ent->fdesc[0] is the virtual address of entry point
-        * and ent->fdesc[1] is the TOC of the module
-        */
-
-       /* let's calculate the virtual address of the symbol 
-        * by adding a relative offset getting from the module 
-        * file symbol table, i.e
-        *
-        *  functin virtual address = entry point virtual address +
-        *     + ( function offset in file - entry point offset in file )
-        */
-
-       (ent->fdesc)[0] = (ent->fdesc)[0] +     
-               ( nl[1].n_value - nl[0].n_value ); 
-
-       /* return the function descriptor */
-       return ent->fdesc;
+        nlist_t nl[3];
+        obj_t*  pobj = (obj_t*)hdl;
+        slot_t* ent;
+        int     (*fp)();
+        long    lbuf[3];
+
+        if( !hdl || !(pobj->htab) || !sym || ! *sym )
+        {
+                errno = EINVAL;
+                return 0;
+        }
+
+        errno = 0;
+        errmsg = 0;
+
+        ent = search( pobj->htab, sym );
+
+        if( ent )
+                return ent->fdesc;
+
+#define n_name  _n._n_name
+
+        nl[0].n_name = ENTRY_SYM;
+        nl[1].n_name = sym;
+        nl[2].n_name = 0;
+
+        /* There is a potential problem here. If application
+         * did not pass a full path name, and changed the
+         * working directory after the load(), then nlist()
+         * will be unable to open the original shared library
+         * file to resolve the symbols. there are 3 ways to working
+         * round this: 1. convert to full pathname in driver
+         * manager. 2. applications always pass driver's full
+         * path name. 3. if driver itself don't support
+         * SQLGetFunctions(), call it with SQL_ALL_FUNCTIONS
+         * as flag immidately after SQLConnect(), SQLDriverConnect()
+         * and SQLBrowseConnect() to force the driver manager
+         * resolving all will be used symbols.
+         */
+        if( nlist( pobj->path, nl) == -1 )
+                return 0;
+
+        if( ! nl[0].n_type && ! nl[0].n_value )
+        {
+                errmsg = "can't locate module entry symbol";
+                return 0;
+        }
+
+        /* Note: On AIX 3.x if the object library is not
+         * built with -g compiling option, .n_type field
+         * is always 0. While on 4.x it will be 32.
+         * On AIX 4.x, if the symbol is a entry point,
+         * n_value will be 0. However, one thing is for sure
+         * that if a symbol is not existance in the file,
+         * both .n_type and .n_value would be 0.
+         */
+
+        if( ! nl[1].n_type && ! nl[1].n_value )
+        {
+                errmsg = "symbol not existance in this module";
+                return 0;
+        }
+
+        ent = slot_alloc(sym);
+
+        if( ! ent )
+                return 0;
+
+        /* catch it with a slot in the hashing table */
+        insert(pobj->htab, ent);
+
+        memcpy(ent->fdesc, pobj->pentry, sizeof(ent->fdesc));
+
+        /* now ent->fdesc[0] is the virtual address of entry point
+         * and ent->fdesc[1] is the TOC of the module
+         */
+
+        /* let's calculate the virtual address of the symbol
+         * by adding a relative offset getting from the module
+         * file symbol table, i.e
+         *
+         *  functin virtual address = entry point virtual address +
+         *     + ( function offset in file - entry point offset in file )
+         */
+
+        (ent->fdesc)[0] = (ent->fdesc)[0] +
+                ( nl[1].n_value - nl[0].n_value );
+
+        /* return the function descriptor */
+        return ent->fdesc;
 }
 
-#endif /* end of IBM AIX Section */
+#endif  /* end of IBM AIX Section */
 
 
-/********************************* 
+/*********************************
  *
- *     Windows 3.x, 95, NT
+ *      Windows 3.x, 95, NT
  *
  *********************************/
-#ifdef DLDAPI_WINDOWS
-# define       DLDAPI_DEFINED
-# include      <windows.h>
+#ifdef  DLDAPI_WINDOWS
+# define        DLDAPI_DEFINED
+# include       <windows.h>
 
-void FAR*      dlopen(char FAR* dll, int mode)
+void FAR*       dlopen(char FAR* dll, int mode)
 {
-       HINSTANCE       hint;
+        HINSTANCE       hint;
 
-       if( dll == NULL )
-       {
-               return GetWindowWord( NULL, GWW_HINSTANCE );
-       }
+        if( dll == NULL )
+        {
+                return GetWindowWord( NULL, GWW_HINSTANCE );
+        }
 
-       hint = LoadLibrary(dll);
+        hint = LoadLibrary(dll);
 
-       if( hint < HINSTANCE_ERROR )
-       {
-               return NULL;
-       }
+        if( hint < HINSTANCE_ERROR )
+        {
+                return NULL;
+        }
 
-       return (void FAR*)hint;
+        return (void FAR*)hint;
 }
 
-void FAR*      dlsym( void FAR* hdll, char FAR* sym )
+void FAR*       dlsym( void FAR* hdll, char FAR* sym )
 {
-       return (void FAR*)GetProcAddress(hdll, sym);
+        return (void FAR*)GetProcAddress(hdll, sym);
 }
 
-char FAR*      dlerror()
+char FAR*       dlerror()
 {
-       return 0L; /* unimplemented yet */
+        return 0L; /* unimplemented yet */
 }
 
-int    dlclose(void FAR* hdll)
+int     dlclose(void FAR* hdll)
 {
-       FreeLibrary((HINSTANCE)hdll);
+        FreeLibrary((HINSTANCE)hdll);
 }
 
-#endif /* end of Windows family */
+#endif  /* end of Windows family */
 
-/***********************************
+/*********************************
  *
- *     other platforms
+ *      OS/2 2.x, 3.x
  *
- ***********************************/
+ *********************************/
 #ifdef DLDAPI_OS2
-# define       DLDAPI_DEFINED
+# define        DLDAPI_DEFINED
 /*
- *     DosLoadModule(), DosQueryProcAddress(), DosFreeModule(), ...
+ *      DosLoadModule(), DosQueryProcAddress(), DosFreeModule(), ...
  */
+
+void FAR*       dlopen(char FAR* dll, int mode)
+{
+        APIRET  rc             = NO_ERROR;       /* API return code          */
+        UCHAR   LoadError[256] = "";             /* Area for Load fail. info */
+        HMODULE ModuleHandle   = NULLHANDLE;     /* Module handle            */
+
+        if( dll == NULL || '\0' == *dll )
+        {
+                return NULL;
+        }
+
+        rc = NO_ERROR;
+        rc = DosLoadModule( LoadError,           /* Failure info buffer      */
+                            sizeof(LoadError),   /* Size of buffer           */
+                            dll,                 /* Module to load           */
+                            &ModuleHandle );     /* Module handle returned   */
+        if (rc != NO_ERROR)
+        {
+#ifdef DEBUG
+                fprintf( stderr,
+                         "[dlf.c] dlopen: DosLoadModule(0x%08lX, %d, \"%s\", 0x%08lX) = %d\n",
+                         &LoadError, sizeof(LoadError), dll, &ModuleHandle, rc
+                       );
+                fprintf( stderr,
+                         "                ---> missing module '%s'\n",
+                         LoadError );
 #endif
+                return NULL;
+        }
 
-#ifdef DLDAPI_MAC
-# define       DLDAPI_DEFINED
+        return (void FAR*) ModuleHandle;
+
+}
+
+void FAR*       dlsym( void FAR* hdll, char FAR* sym )
+{
+        APIRET  rc             = NO_ERROR;       /* API return code          */
+        PFN     ModuleAddress  = NULL;           /* Module address           */
+
+        rc = DosQueryProcAddr( (HMODULE) hdll, 0, sym, &ModuleAddress );
+
+        return (void FAR*) (NO_ERROR == rc) ? ModuleAddress
+                                            : NULL;
+}
+
+char FAR*       dlerror()
+{
+        return 0L; /* unimplemented yet */
+}
+
+int     dlclose(void FAR* hdll)
+{
+        return DosFreeModule( (HMODULE) hdll );
+}
+
+#endif
+
+/***********************************
+ *
+ *      other platforms
+ *
+ ***********************************/
+#ifdef  DLDAPI_MAC
+# define        DLDAPI_DEFINED
 #endif
 
 #ifdef DLDAPI_NEXT
-# define       DLDAPI_DEFINED
+# define        DLDAPI_DEFINED
 #endif
 
 #ifndef DLDAPI_DEFINED
-# error        "dynamic load editor undefined"
+# error "dynamic load editor undefined"
 #endif
index 185b478c07ee71b0fffa7c829791edafb3f7bf9e..2d04cf39b281b274a5385ef129d7a561793bb24a 100644 (file)
@@ -1,35 +1,24 @@
-#ifndef        _DLF_H
+#ifndef _DLF_H
 # define _DLF_H
 
 #define DLDAPI_SVR4_DLFCN
 
-#ifdef __HPUX__
-#define DLDAPI_HP_SHL
-#endif
-
-#ifdef __AIX__
-#define DLDAPI_AIX_LOAD
-#endif
-
-# include      <../iodbc/config.h>
-# include      <../iodbc/windows.h>
-
 # ifdef DLDAPI_SVR4_DLFCN
-#    include   <dlfcn.h>
+#    include    <dlfcn.h>
 # else
-     extern void FAR*  dlopen(char FAR* path, int mode);
-     extern void FAR*  dlsym(void FAR* hdll, char FAR* sym);
-     extern char FAR*  dlerror();
-     extern int                dlclose(void FAR* hdll);
+     extern void FAR*   dlopen(char FAR* path, int mode);
+     extern void FAR*   dlsym(void FAR* hdll, char FAR* sym);
+     extern char FAR*   dlerror();
+     extern int         dlclose(void FAR* hdll);
 # endif
 
-# ifndef       RTLD_LAZY
-#    define    RTLD_LAZY       1
+# ifndef        RTLD_LAZY
+#    define     RTLD_LAZY       1
 # endif
 
-# define       DLL_OPEN(dll)           (void*)dlopen((char*)(path), RTLD_LAZY)
-# define       DLL_PROC(hdll, sym)     (void*)dlsym((void*)(hdll), (char*)sym)
-# define       DLL_ERROR()             (char*)dlerror()
-# define       DLL_CLOSE(hdll)         dlclose((void*)(hdll))
+# define        DLL_OPEN(dll)           (void*)dlopen((char*)(path), RTLD_LAZY)
+# define        DLL_PROC(hdll, sym)     (void*)dlsym((void*)(hdll), (char*)sym)
+# define        DLL_ERROR()             (char*)dlerror()
+# define        DLL_CLOSE(hdll)         dlclose((void*)(hdll))
 
 #endif
index db23fa256264111d5d05f0e909043d388c457b86..24f1bfda9cee849f2de647d89792325ad00876d2 100644 (file)
@@ -1,6 +1,6 @@
-/** Load driver and resolve driver's function entry point 
-      
-    Copyright (C) 1995 by Ke Jin <kejin@empress.com> 
+/** Load driver and resolve driver's function entry point
+
+    Copyright (C) 1995 by Ke Jin <kejin@empress.com>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -13,6 +13,7 @@
     GNU General Public License for more details.
 **/
 
+
 #include       <../iodbc/iodbc.h>
 
 #include       <../iodbc/isql.h>
 
 #include       "../iodbc/henv.ci"
 
-HPROC  _iodbcdm_getproc( HDBC hdbc, int idx )
+HPROC   _iodbcdm_getproc( HDBC hdbc, int idx )
 {
-       DBC_t FAR*      pdbc    = (DBC_t FAR*)hdbc;
-       ENV_t FAR*      penv;
-/*     HDLL            hdll; */
      HPROC FAR*      phproc;
-
-       if( idx <= 0 || idx > SQL_EXT_API_LAST )
-       /* first entry naver used */
-       {
-               return SQL_NULL_HPROC;
-       }
-       
-       penv = (ENV_t FAR*)(pdbc->henv);
-
-       if( penv == NULL )
-       {
-               return SQL_NULL_HPROC;
-       }
-
-       phproc = penv->dllproc_tab + idx;
-
-       if( *phproc == SQL_NULL_HPROC )
-       {
-               int     i, en_idx;
-
-               for( i=0 ; ; i++ )
-               {
-                       en_idx = odbcapi_symtab[i].en_idx;
-                       
-                       if( en_idx == en_NullProc )
-                       {
-                               break;
-                       }
-
-                       if( en_idx == idx )
-                       {
-                               *phproc = _iodbcdm_dllproc( penv->hdll, 
-                                       odbcapi_symtab[i].symbol );
-
-                               break;
-                       }
-               }
-       }
-
-       return *phproc;
+        DBC_t FAR*      pdbc    = (DBC_t FAR*)hdbc;
+        ENV_t FAR*      penv;
+        HDLL            hdll;
static HPROC FAR*      phproc;
+
+        if( idx <= 0 || idx > SQL_EXT_API_LAST )
+        /* first entry never used */
+        {
+                return SQL_NULL_HPROC;
+        }
+
+        penv = (ENV_t FAR*)(pdbc->henv);
+
+        if( penv == NULL )
+        {
+                return SQL_NULL_HPROC;
+        }
+
+        phproc = penv->dllproc_tab + idx;
+
+        if( *phproc == SQL_NULL_HPROC )
+        {
+                int     i, en_idx;
+
+                for( i=0 ; ; i++ )
+                {
+                        en_idx = odbcapi_symtab[i].en_idx;
+
+                        if( en_idx == en_NullProc )
+                        {
+                                break;
+                        }
+
+                        if( en_idx == idx )
+                        {
+                                *phproc = _iodbcdm_dllproc( penv->hdll,
+                                        odbcapi_symtab[i].symbol );
+
+                                break;
+                        }
+                }
+        }
+
+        return *phproc;
 }
 
-HDLL   _iodbcdm_dllopen( char FAR* path )
+HDLL    _iodbcdm_dllopen( char FAR* path )
 {
-       return  (HDLL)DLL_OPEN( path );
+        return  (HDLL)DLL_OPEN( path );
 }
 
-HPROC  _iodbcdm_dllproc( HDLL hdll, char FAR* sym )
+HPROC   _iodbcdm_dllproc( HDLL hdll, char FAR* sym )
 {
-       return (HPROC)DLL_PROC( hdll, sym );
+        return (HPROC)DLL_PROC( hdll, sym );
 }
 
-int    _iodbcdm_dllclose( HDLL hdll )
+int     _iodbcdm_dllclose( HDLL hdll )
 {
-       DLL_CLOSE( hdll );
+        DLL_CLOSE( hdll );
 
-       return 0;
+        return 0;
 }
 
-char*  _iodbcdm_dllerror( )
+char*   _iodbcdm_dllerror( )
 {
-       return DLL_ERROR();
+        return DLL_ERROR();
 }
index 127b0d4c64545b94fcbe285f4047515dbe9e6e2b..b757369a8b045bd62c83121c834f13c072cd94ef 100644 (file)
@@ -1,31 +1,39 @@
-#ifndef        _DLPROC_H
-# define       _DLPROC_H
+#ifndef _DLPROC_H
+# define        _DLPROC_H
 
-# include      <../iodbc/dlf.h>
+# include       <../iodbc/dlf.h>
 
-  typedef      RETCODE         (FAR* HPROC)();
+# ifdef OS2
+  typedef       RETCODE         (FAR* _System HPROC)();
+# else
+  typedef       RETCODE         (FAR* HPROC)();
+# endif
 
-# ifdef        DLDAPI_SVR4_DLFCN
-#  include     <dlfcn.h>
-   typedef void*       HDLL; 
+# ifdef DLDAPI_SVR4_DLFCN
+#  include      <dlfcn.h>
+   typedef void*        HDLL;
 # endif
 
 # ifdef DLDAPI_HP_SHL
-#  include     <dl.h>
-   typedef shl_t       HDLL;
+#  include      <dl.h>
+   typedef shl_t        HDLL;
+# endif
+
+# ifdef DLDAPI_AIX_LOAD
+    typedef void*        HDLL;
 # endif
 
-# ifdef        DLDAPI_AIX_LOAD
-   typedef void*       HDLL;
+# ifdef DLDAPI_OS2
+  typedef HMODULE      HDLL;
 # endif
 
-extern  HPROC          _iodbcdm_getproc();
-extern HDLL            _iodbcdm_dllopen(char FAR* dll);
-extern HPROC           _iodbcdm_dllproc(HDLL hdll, char FAR* sym);
-extern char FAR*       _iodbcdm_dllerror();
-extern  int            _iodbcdm_dllclose(HDLL hdll);
+extern  HPROC           _iodbcdm_getproc();
+extern  HDLL            _iodbcdm_dllopen(char FAR* dll);
+extern  HPROC           _iodbcdm_dllproc(HDLL hdll, char FAR* sym);
+extern  char FAR*       _iodbcdm_dllerror();
+extern  int             _iodbcdm_dllclose(HDLL hdll);
 
-#define        SQL_NULL_HDLL   ((HDLL)NULL)
-#define        SQL_NULL_HPROC  ((HPROC)NULL)
+#define SQL_NULL_HDLL   ((HDLL)NULL)
+#define SQL_NULL_HPROC  ((HPROC)NULL)
 
 #endif
index eb2633a6edbcf3066d235c0a683c54afd6d91968..bdb8f7dcd8933ebd98a7c073a3a78eec5e0d3a2c 100644 (file)
@@ -1,6 +1,6 @@
-/** Invoke a query 
-       
-    Copyright (C) 1995 by Ke Jin <kejin@empress.com> 
+/** Invoke a query
+
+    Copyright (C) 1995 by Ke Jin <kejin@empress.com>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 
 #include       <../iodbc/itrace.h>
 
-static void    do_cursoropen(STMT_t FAR* pstmt)
+static void     do_cursoropen(STMT_t FAR* pstmt)
 {
-       RETCODE retcode;
-       SWORD   ncol;
-
-       pstmt->state = en_stmt_executed;
-
-       retcode = SQLNumResultCols( pstmt, &ncol );
-
-       if( retcode == SQL_SUCCESS
-        || retcode == SQL_SUCCESS_WITH_INFO )
-       {
-               if( ncol )
-               {
-                       pstmt->state = en_stmt_cursoropen;
-                       pstmt->cursor_state = en_stmt_cursor_opened;
-               }
-               else
-               {
-                       pstmt->state = en_stmt_executed;
-                       pstmt->cursor_state = en_stmt_cursor_no;
-               }
-       }
+        RETCODE retcode;
+        SWORD   ncol;
+
+        pstmt->state = en_stmt_executed;
+
+        retcode = SQLNumResultCols( pstmt, &ncol );
+
+        if( retcode == SQL_SUCCESS
+         || retcode == SQL_SUCCESS_WITH_INFO )
+        {
+                if( ncol )
+                {
+                        pstmt->state = en_stmt_cursoropen;
+                        pstmt->cursor_state = en_stmt_cursor_opened;
+                }
+                else
+                {
+                        pstmt->state = en_stmt_executed;
+                        pstmt->cursor_state = en_stmt_cursor_no;
+                }
+        }
 }
 
-RETCODE SQL_API        SQLExecute ( HSTMT hstmt )
+RETCODE SQL_API SQLExecute ( HSTMT hstmt )
 {
-       STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
-       HPROC           hproc   = SQL_NULL_HPROC;
-       RETCODE         retcode;
-
-       int             sqlstat = en_00000;
-
-       if( hstmt == SQL_NULL_HSTMT 
-        || pstmt->hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       } 
-
-       /* check state */
-       if( pstmt->asyn_on == en_NullProc )
-       {
-               switch( pstmt->state )
-               {
-                       case en_stmt_allocated:
-                               sqlstat = en_S1010;
-                               break;
-       
-                       case en_stmt_executed:
-                               if( ! pstmt->prep_state )
-                               {
-                                       sqlstat = en_S1010;
-                               }
-                               break;
-       
-                       case en_stmt_cursoropen:
-                               if( ! pstmt->prep_state )
-                               {
-                                       sqlstat = en_S1010;
-                               }
-                               break;
-       
-                       case en_stmt_fetched:
-                       case en_stmt_xfetched:
-                               if( ! pstmt->prep_state )
-                               {
-                                       sqlstat = en_S1010;
-                               }
-                               else
-                               {
-                                       sqlstat = en_24000;
-                               }
-                               break;
-                                       
-                       case en_stmt_needdata:
-                       case en_stmt_mustput:
-                       case en_stmt_canput:
-                               sqlstat = en_S1010;
-                               break;
-       
-                       default:
-                               break;
-               }
-       }
-       else if( pstmt->asyn_on != en_Execute )
-       {
-               sqlstat = en_S1010;
-       }
-       
-       if( sqlstat == en_00000 )
-       {
-               hproc = _iodbcdm_getproc( pstmt->hdbc, en_Execute );
-
-               if( hproc == SQL_NULL_HPROC )
-               {
-                       sqlstat = en_IM001;
-               }
-       }
-
-       if( sqlstat != en_00000 )
-       {
-               PUSHSQLERR ( pstmt->herr, sqlstat );
-
-               return SQL_ERROR;
-       }
-       
-       CALL_DRIVER ( pstmt->hdbc, retcode, hproc, 
-               en_Execute, ( pstmt->dhstmt ) )
-                       
+        STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
+        HPROC           hproc   = SQL_NULL_HPROC;
+        RETCODE         retcode;
+
+        int             sqlstat = en_00000;
+
+        if( hstmt == SQL_NULL_HSTMT
+         || pstmt->hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        /* check state */
+        if( pstmt->asyn_on == en_NullProc )
+        {
+                switch( pstmt->state )
+                {
+                        case en_stmt_allocated:
+                                sqlstat = en_S1010;
+                                break;
+
+                        case en_stmt_executed:
+                                if( ! pstmt->prep_state )
+                                {
+                                        sqlstat = en_S1010;
+                                }
+                                break;
+
+                        case en_stmt_cursoropen:
+                                if( ! pstmt->prep_state )
+                                {
+                                        sqlstat = en_S1010;
+                                }
+                                break;
+
+                        case en_stmt_fetched:
+                        case en_stmt_xfetched:
+                                if( ! pstmt->prep_state )
+                                {
+                                        sqlstat = en_S1010;
+                                }
+                                else
+                                {
+                                        sqlstat = en_24000;
+                                }
+                                break;
+
+                        case en_stmt_needdata:
+                        case en_stmt_mustput:
+                        case en_stmt_canput:
+                                sqlstat = en_S1010;
+                                break;
+
+                        default:
+                                break;
+                }
+        }
+        else if( pstmt->asyn_on != en_Execute )
+        {
+                sqlstat = en_S1010;
+        }
+
+        if( sqlstat == en_00000 )
+        {
+                hproc = _iodbcdm_getproc( pstmt->hdbc, en_Execute );
+
+                if( hproc == SQL_NULL_HPROC )
+                {
+                        sqlstat = en_IM001;
+                }
+        }
+
+        if( sqlstat != en_00000 )
+        {
+                PUSHSQLERR ( pstmt->herr, sqlstat );
+
+                return SQL_ERROR;
+        }
+
+        CALL_DRIVER ( pstmt->hdbc, retcode, hproc,
+                en_Execute, ( pstmt->dhstmt ) )
+
 #if 0
-       retcode = hproc ( pstmt->dhstmt );
+        retcode = hproc ( pstmt->dhstmt );
 #endif
 
-       /* stmt state transition */
-       if( pstmt->asyn_on == en_Execute )
-       {
-               switch ( retcode )
-               {
-                       case SQL_SUCCESS:
-                       case SQL_SUCCESS_WITH_INFO:
-                       case SQL_NEED_DATA:
-                       case SQL_ERROR:
-                               pstmt->asyn_on = en_NullProc;
-                               break;
-
-                       case SQL_STILL_EXECUTING:
-                       default:
-                               return retcode;
-               }
-       }
-
-       switch( pstmt->state )
-       {
-               case en_stmt_prepared:
-                       switch( retcode )
-                       {
-                               case SQL_SUCCESS:
-                               case SQL_SUCCESS_WITH_INFO:
-                                       do_cursoropen(hstmt);
-                                       break;
-
-                               case SQL_NEED_DATA: 
-                                       pstmt->state = en_stmt_needdata;
-                                       pstmt->need_on = en_Execute;
-                                       break;
-
-                               case SQL_STILL_EXECUTING:
-                                       pstmt->asyn_on = en_Execute;
-                                       break;
-
-                               default:
-                                       break;
-                       }
-                       break;
-
-               case en_stmt_executed:
-                       switch( retcode )
-                       {
-                               case SQL_ERROR:
-                                       pstmt->state = en_stmt_allocated;
-                                       pstmt->cursor_state = en_stmt_cursor_no;
-                                       pstmt->prep_state = 0;
-                                       break;
-
-                               case SQL_NEED_DATA:
-                                       pstmt->state = en_stmt_needdata;
-                                       pstmt->need_on = en_Execute;
-                                       break;
-
-                               case SQL_STILL_EXECUTING:
-                                       pstmt->asyn_on = en_Execute;
-                                       break;
-
-                               default:
-                                       break;
-                       }
-                       break;
-
-               default:
-                       break;
-       }
-
-       return retcode;
+        /* stmt state transition */
+        if( pstmt->asyn_on == en_Execute )
+        {
+                switch ( retcode )
+                {
+                        case SQL_SUCCESS:
+                        case SQL_SUCCESS_WITH_INFO:
+                        case SQL_NEED_DATA:
+                        case SQL_ERROR:
+                                pstmt->asyn_on = en_NullProc;
+                                break;
+
+                        case SQL_STILL_EXECUTING:
+                        default:
+                                return retcode;
+                }
+        }
+
+        switch( pstmt->state )
+        {
+                case en_stmt_prepared:
+                        switch( retcode )
+                        {
+                                case SQL_SUCCESS:
+                                case SQL_SUCCESS_WITH_INFO:
+                                        do_cursoropen(hstmt);
+                                        break;
+
+                                case SQL_NEED_DATA:
+                                        pstmt->state = en_stmt_needdata;
+                                        pstmt->need_on = en_Execute;
+                                        break;
+
+                                case SQL_STILL_EXECUTING:
+                                        pstmt->asyn_on = en_Execute;
+                                        break;
+
+                                default:
+                                        break;
+                        }
+                        break;
+
+                case en_stmt_executed:
+                        switch( retcode )
+                        {
+                                case SQL_ERROR:
+                                        pstmt->state = en_stmt_allocated;
+                                        pstmt->cursor_state = en_stmt_cursor_no;
+                                        pstmt->prep_state = 0;
+                                        break;
+
+                                case SQL_NEED_DATA:
+                                        pstmt->state = en_stmt_needdata;
+                                        pstmt->need_on = en_Execute;
+                                        break;
+
+                                case SQL_STILL_EXECUTING:
+                                        pstmt->asyn_on = en_Execute;
+                                        break;
+
+                                default:
+                                        break;
+                        }
+                        break;
+
+                default:
+                        break;
+        }
+
+        return retcode;
 }
 
-RETCODE SQL_API        SQLExecDirect (
-                       HSTMT           hstmt,
-                       UCHAR FAR*      szSqlStr,
-                       SDWORD          cbSqlStr )
+RETCODE SQL_API SQLExecDirect (
+                        HSTMT           hstmt,
+                        UCHAR FAR*      szSqlStr,
+                        SDWORD          cbSqlStr )
 {
-       STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
-       HPROC           hproc   = SQL_NULL_HPROC;
-
-       int             sqlstat = en_00000;
-       RETCODE         retcode = SQL_SUCCESS;
-
-       if( hstmt == SQL_NULL_HSTMT 
-        || pstmt->hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       /* check arguments */
-       if( szSqlStr == NULL )
-       {
-               sqlstat = en_S1009;
-       }
-       else if( cbSqlStr < 0 && cbSqlStr != SQL_NTS )
-       {
-               sqlstat = en_S1090;
-       }
-
-       if( sqlstat != en_00000 )
-       {
-               PUSHSQLERR ( pstmt->herr, sqlstat );
-
-               return SQL_ERROR;
-       }
-
-       /* check state */
-       if( pstmt->asyn_on == en_NullProc )
-       {
-               switch ( pstmt->state )
-               {
-                       case en_stmt_fetched:
-                       case en_stmt_xfetched:
-                               sqlstat = en_24000;
-                               break;
-       
-                       case en_stmt_needdata:
-                       case en_stmt_mustput:
-                       case en_stmt_canput:
-                               sqlstat = en_S1010;
-                               break;
-       
-                       default:
-                               break;
-               }
-       }
-       else if( pstmt->asyn_on != en_ExecDirect )
-       {
-               sqlstat = en_S1010;
-       }
-
-       if( sqlstat != en_00000 )
-       {
-               PUSHSQLERR ( pstmt->herr, sqlstat );
-
-               return SQL_ERROR;
-       }
-
-       hproc = _iodbcdm_getproc( pstmt->hdbc, en_ExecDirect);
-
-       if( hproc == SQL_NULL_HPROC )
-       {
-               PUSHSQLERR ( pstmt->herr, en_IM001 );
-
-               return SQL_ERROR;
-       }
-
-       CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_ExecDirect, (
-                       pstmt->dhstmt, szSqlStr, cbSqlStr) )
-       
+        STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
+        HPROC           hproc   = SQL_NULL_HPROC;
+
+        int             sqlstat = en_00000;
+        RETCODE         retcode = SQL_SUCCESS;
+
+        if( hstmt == SQL_NULL_HSTMT
+         || pstmt->hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        /* check arguments */
+        if( szSqlStr == NULL )
+        {
+                sqlstat = en_S1009;
+        }
+        else if( cbSqlStr < 0 && cbSqlStr != SQL_NTS )
+        {
+                sqlstat = en_S1090;
+        }
+
+        if( sqlstat != en_00000 )
+        {
+                PUSHSQLERR ( pstmt->herr, sqlstat );
+
+                return SQL_ERROR;
+        }
+
+        /* check state */
+        if( pstmt->asyn_on == en_NullProc )
+        {
+                switch ( pstmt->state )
+                {
+                        case en_stmt_fetched:
+                        case en_stmt_xfetched:
+                                sqlstat = en_24000;
+                                break;
+
+                        case en_stmt_needdata:
+                        case en_stmt_mustput:
+                        case en_stmt_canput:
+                                sqlstat = en_S1010;
+                                break;
+
+                        default:
+                                break;
+                }
+        }
+        else if( pstmt->asyn_on != en_ExecDirect )
+        {
+                sqlstat = en_S1010;
+        }
+
+        if( sqlstat != en_00000 )
+        {
+                PUSHSQLERR ( pstmt->herr, sqlstat );
+
+                return SQL_ERROR;
+        }
+
+        hproc = _iodbcdm_getproc( pstmt->hdbc, en_ExecDirect);
+
+        if( hproc == SQL_NULL_HPROC )
+        {
+                PUSHSQLERR ( pstmt->herr, en_IM001 );
+
+                return SQL_ERROR;
+        }
+
+        CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_ExecDirect, (
+                        pstmt->dhstmt, szSqlStr, cbSqlStr) )
+
 
 #if 0
-       retcode = hproc ( pstmt->dhstmt, szSqlStr, cbSqlStr );
+        retcode = hproc ( pstmt->dhstmt, szSqlStr, cbSqlStr );
 #endif
 
-       /* stmt state transition */
-       if( pstmt->asyn_on == en_ExecDirect )
-       {
-               switch ( retcode )
-               {
-                       case SQL_SUCCESS:
-                       case SQL_SUCCESS_WITH_INFO:
-                       case SQL_NEED_DATA:
-                       case SQL_ERROR:
-                               pstmt->asyn_on = en_NullProc;
-                               break;
-
-                       case SQL_STILL_EXECUTING:
-                       default:
-                               return retcode;
-               }
-       }
-       
-       if( pstmt->state <= en_stmt_executed )
-       {
-               switch( retcode )
-               {
-                       case SQL_SUCCESS:
-                       case SQL_SUCCESS_WITH_INFO:
-                               do_cursoropen(hstmt);
-                               break;
-
-                       case SQL_NEED_DATA:
-                               pstmt->state = en_stmt_needdata;
-                               pstmt->need_on = en_ExecDirect;
-                               break;
-
-                       case SQL_STILL_EXECUTING:
-                               pstmt->asyn_on = en_ExecDirect;
-                               break;
-
-                       case SQL_ERROR:
-                               pstmt->state = en_stmt_allocated;
-                               pstmt->cursor_state = en_stmt_cursor_no;
-                               pstmt->prep_state = 0;
-                               break;
-                       
-                       default:
-                               break;
-               }
-       }
-
-       return retcode;
+        /* stmt state transition */
+        if( pstmt->asyn_on == en_ExecDirect )
+        {
+                switch ( retcode )
+                {
+                        case SQL_SUCCESS:
+                        case SQL_SUCCESS_WITH_INFO:
+                        case SQL_NEED_DATA:
+                        case SQL_ERROR:
+                                pstmt->asyn_on = en_NullProc;
+                                break;
+
+                        case SQL_STILL_EXECUTING:
+                        default:
+                                return retcode;
+                }
+        }
+
+        if( pstmt->state <= en_stmt_executed )
+        {
+                switch( retcode )
+                {
+                        case SQL_SUCCESS:
+                        case SQL_SUCCESS_WITH_INFO:
+                                do_cursoropen(hstmt);
+                                break;
+
+                        case SQL_NEED_DATA:
+                                pstmt->state = en_stmt_needdata;
+                                pstmt->need_on = en_ExecDirect;
+                                break;
+
+                        case SQL_STILL_EXECUTING:
+                                pstmt->asyn_on = en_ExecDirect;
+                                break;
+
+                        case SQL_ERROR:
+                                pstmt->state = en_stmt_allocated;
+                                pstmt->cursor_state = en_stmt_cursor_no;
+                                pstmt->prep_state = 0;
+                                break;
+
+                        default:
+                                break;
+                }
+        }
+
+        return retcode;
 }
 
-RETCODE SQL_API        SQLPutData( 
-                       HSTMT   hstmt,
-                       PTR     rgbValue,
-                       SDWORD  cbValue )
+RETCODE SQL_API SQLPutData(
+                        HSTMT   hstmt,
+                        PTR     rgbValue,
+                        SDWORD  cbValue )
 {
-       STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
-       HPROC           hproc;
-       RETCODE         retcode;
-
-       if( hstmt == SQL_NULL_HSTMT
-        || pstmt->hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       /* check argument value */
-       if( rgbValue == NULL
-        && ( cbValue != SQL_DEFAULT_PARAM
-          && cbValue != SQL_NULL_DATA ) )
-       {
-               PUSHSQLERR ( pstmt->herr, en_S1009 );
-
-               return SQL_ERROR;
-       }
-
-       /* check state */
-       if( pstmt->asyn_on == en_NullProc )
-       {
-               if( pstmt->state <= en_stmt_xfetched )
-               {
-                       PUSHSQLERR( pstmt->herr, en_S1010 );
-
-                       return SQL_ERROR;
-               }
-       }
-       else if( pstmt->asyn_on != en_PutData )
-       {
-               PUSHSQLERR ( pstmt->herr, en_S1010 );
-
-               return SQL_ERROR;
-       }
-
-       /* call driver */
-       hproc = _iodbcdm_getproc( pstmt->hdbc, en_PutData );
-
-       if( hproc == SQL_NULL_HPROC )
-       {
-               PUSHSQLERR ( pstmt->herr, en_IM001 );
-
-               return SQL_ERROR;
-       }
-       
-       CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_PutData, (
-                       pstmt->dhstmt, rgbValue, cbValue ) )
+        STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
+        HPROC           hproc;
+        RETCODE         retcode;
+
+        if( hstmt == SQL_NULL_HSTMT
+         || pstmt->hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        /* check argument value */
+        if( rgbValue == NULL
+         && ( cbValue != SQL_DEFAULT_PARAM
+           && cbValue != SQL_NULL_DATA ) )
+        {
+                PUSHSQLERR ( pstmt->herr, en_S1009 );
+
+                return SQL_ERROR;
+        }
+
+        /* check state */
+        if( pstmt->asyn_on == en_NullProc )
+        {
+                if( pstmt->state <= en_stmt_xfetched )
+                {
+                        PUSHSQLERR( pstmt->herr, en_S1010 );
+
+                        return SQL_ERROR;
+                }
+        }
+        else if( pstmt->asyn_on != en_PutData )
+        {
+                PUSHSQLERR ( pstmt->herr, en_S1010 );
+
+                return SQL_ERROR;
+        }
+
+        /* call driver */
+        hproc = _iodbcdm_getproc( pstmt->hdbc, en_PutData );
+
+        if( hproc == SQL_NULL_HPROC )
+        {
+                PUSHSQLERR ( pstmt->herr, en_IM001 );
+
+                return SQL_ERROR;
+        }
+
+        CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_PutData, (
+                        pstmt->dhstmt, rgbValue, cbValue ) )
 
 #if 0
-       retcode = hproc(pstmt->dhstmt, rgbValue, cbValue );
+        retcode = hproc(pstmt->dhstmt, rgbValue, cbValue );
 #endif
 
-       /* state transition */
-       if( pstmt->asyn_on == en_PutData )
-       {
-               switch( retcode )
-               {
-                       case SQL_SUCCESS:
-                       case SQL_SUCCESS_WITH_INFO:
-                       case SQL_ERROR:
-                               pstmt->asyn_on = en_NullProc;
-                               break;
-
-                       case SQL_STILL_EXECUTING:
-                       default:
-                               return retcode;
-               }
-       }
-
-       /* must in mustput or canput states */
-       switch( retcode )
-       {
-               case SQL_SUCCESS:
-               case SQL_SUCCESS_WITH_INFO:
-                       pstmt->state = en_stmt_canput;
-                       break;
-
-               case SQL_ERROR:
-                       switch( pstmt->need_on )
-                       {
-                               case en_ExecDirect:
-                                       pstmt->state = en_stmt_allocated;
-                                       pstmt->need_on = en_NullProc;
-                                       break;
-
-                               case en_Execute:
-                                       if( pstmt->prep_state )
-                                       {
-                                               pstmt->state = en_stmt_prepared;
-                                               pstmt->need_on = en_NullProc;
-                                       }
-                                       break;
-
-                               case en_SetPos:
-                                       /* Is this possible ???? */
-                                       pstmt->state = en_stmt_xfetched;
-                                       break;
-
-                               default:
-                                       break;
-                       }
-                       break;
-
-               case SQL_STILL_EXECUTING:
-                       pstmt->asyn_on = en_PutData;
-                       break;
-
-               default:
-                       break;
-       }
-
-       return retcode;
+        /* state transition */
+        if( pstmt->asyn_on == en_PutData )
+        {
+                switch( retcode )
+                {
+                        case SQL_SUCCESS:
+                        case SQL_SUCCESS_WITH_INFO:
+                        case SQL_ERROR:
+                                pstmt->asyn_on = en_NullProc;
+                                break;
+
+                        case SQL_STILL_EXECUTING:
+                        default:
+                                return retcode;
+                }
+        }
+
+        /* must in mustput or canput states */
+        switch( retcode )
+        {
+                case SQL_SUCCESS:
+                case SQL_SUCCESS_WITH_INFO:
+                        pstmt->state = en_stmt_canput;
+                        break;
+
+                case SQL_ERROR:
+                        switch( pstmt->need_on )
+                        {
+                                case en_ExecDirect:
+                                        pstmt->state = en_stmt_allocated;
+                                        pstmt->need_on = en_NullProc;
+                                        break;
+
+                                case en_Execute:
+                                        if( pstmt->prep_state )
+                                        {
+                                                pstmt->state = en_stmt_prepared;
+                                                pstmt->need_on = en_NullProc;
+                                        }
+                                        break;
+
+                                case en_SetPos:
+                                        /* Is this possible ???? */
+                                        pstmt->state = en_stmt_xfetched;
+                                        break;
+
+                                default:
+                                        break;
+                        }
+                        break;
+
+                case SQL_STILL_EXECUTING:
+                        pstmt->asyn_on = en_PutData;
+                        break;
+
+                default:
+                        break;
+        }
+
+        return retcode;
 }
 
-RETCODE SQL_API        SQLParamData (
-                       HSTMT           hstmt,
-                       PTR FAR*        prgbValue )
+RETCODE SQL_API SQLParamData (
+                        HSTMT           hstmt,
+                        PTR FAR*        prgbValue )
 {
-       STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
-       HPROC           hproc;
-       RETCODE         retcode;
+        STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
+        HPROC           hproc;
+        RETCODE         retcode;
 
-       if( hstmt == SQL_NULL_HSTMT
-        || pstmt->hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
+        if( hstmt == SQL_NULL_HSTMT
+         || pstmt->hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
 
-       /* check argument */
+        /* check argument */
 
-       /* check state */
-       if( pstmt->asyn_on == en_NullProc )
-       {
-               if( pstmt->state <= en_stmt_xfetched )
-               {
-                       PUSHSQLERR ( pstmt->herr, en_S1010 );
+        /* check state */
+        if( pstmt->asyn_on == en_NullProc )
+        {
+                if( pstmt->state <= en_stmt_xfetched )
+                {
+                        PUSHSQLERR ( pstmt->herr, en_S1010 );
 
-                       return SQL_ERROR;
-               }
-       }
-       else if( pstmt->asyn_on != en_ParamData )
-       {
-               PUSHSQLERR ( pstmt->herr, en_S1010 );
+                        return SQL_ERROR;
+                }
+        }
+        else if( pstmt->asyn_on != en_ParamData )
+        {
+                PUSHSQLERR ( pstmt->herr, en_S1010 );
 
-               return SQL_ERROR;
-       }
+                return SQL_ERROR;
+        }
 
-       /* call driver */
-       hproc = _iodbcdm_getproc( pstmt->hdbc, en_ParamData );
+        /* call driver */
+        hproc = _iodbcdm_getproc( pstmt->hdbc, en_ParamData );
 
-       if( hproc == SQL_NULL_HPROC )
-       {
-               PUSHSQLERR ( pstmt->herr, en_IM001 );
+        if( hproc == SQL_NULL_HPROC )
+        {
+                PUSHSQLERR ( pstmt->herr, en_IM001 );
 
-               return SQL_ERROR;
-       }
+                return SQL_ERROR;
+        }
 
-       CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_ParamData, (
-                       pstmt->dhstmt, prgbValue ) )
+        CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_ParamData, (
+                        pstmt->dhstmt, prgbValue ) )
 
 #if 0
-       retcode = hproc ( pstmt->dhstmt, prgbValue );
+        retcode = hproc ( pstmt->dhstmt, prgbValue );
 #endif
 
-       /* state transition */
-       if( pstmt->asyn_on == en_ParamData )
-       {
-               switch( retcode )
-               {
-                       case SQL_SUCCESS:
-                       case SQL_SUCCESS_WITH_INFO:
-                       case SQL_ERROR:
-                               pstmt->asyn_on = en_NullProc;
-                               break;
-
-                       case SQL_STILL_EXECUTING:
-                       default:
-                               return retcode;
-               }
-       }
-
-       if( pstmt->state < en_stmt_needdata )
-       {
-               return retcode;
-       }
-
-       switch( retcode )
-       {
-               case SQL_ERROR:
-                       switch( pstmt->need_on )
-                       {
-                               case en_ExecDirect:
-                                       pstmt->state = en_stmt_allocated;
-                                       break;
-               
-                               case en_Execute:
-                                       pstmt->state = en_stmt_prepared;
-                                       break;
-
-                               case en_SetPos:
-                                       pstmt->state = en_stmt_xfetched;
-                                       pstmt->cursor_state 
-                                               = en_stmt_cursor_xfetched;
-                                       break;
-
-                               default:
-                                       break;
-                       }
-                       pstmt->need_on = en_NullProc;
-                       break;
-
-               case SQL_SUCCESS:
-               case SQL_SUCCESS_WITH_INFO:
-                       switch( pstmt->state )
-                       {
-                               case en_stmt_needdata:
-                                       pstmt->state = en_stmt_mustput;
-                                       break;
-                               
-                               case en_stmt_canput: 
-                                       switch( pstmt->need_on )
-                                       {
-                                               case en_SetPos:
-                                                       pstmt->state 
-                                                       = en_stmt_xfetched;
-                                                       pstmt->cursor_state 
-                                                       = en_stmt_cursor_xfetched;
-                                                       break;
-
-                                               case en_ExecDirect:
-                                               case en_Execute:
-                                                       do_cursoropen(hstmt);
-                                                       break;
-
-                                               default:
-                                                       break;
-                                       }
-                                       break;
-
-                               default:
-                                       break;
-                       }
-                       pstmt->need_on = en_NullProc;
-                       break;
-
-               case SQL_NEED_DATA:
-                       pstmt->state = en_stmt_mustput;
-                       break;
-
-               default:
-                       break;
-       }
-
-       return retcode;
+        /* state transition */
+        if( pstmt->asyn_on == en_ParamData )
+        {
+                switch( retcode )
+                {
+                        case SQL_SUCCESS:
+                        case SQL_SUCCESS_WITH_INFO:
+                        case SQL_ERROR:
+                                pstmt->asyn_on = en_NullProc;
+                                break;
+
+                        case SQL_STILL_EXECUTING:
+                        default:
+                                return retcode;
+                }
+        }
+
+        if( pstmt->state < en_stmt_needdata )
+        {
+                return retcode;
+        }
+
+        switch( retcode )
+        {
+                case SQL_ERROR:
+                        switch( pstmt->need_on )
+                        {
+                                case en_ExecDirect:
+                                        pstmt->state = en_stmt_allocated;
+                                        break;
+
+                                case en_Execute:
+                                        pstmt->state = en_stmt_prepared;
+                                        break;
+
+                                case en_SetPos:
+                                        pstmt->state = en_stmt_xfetched;
+                                        pstmt->cursor_state
+                                                = en_stmt_cursor_xfetched;
+                                        break;
+
+                                default:
+                                        break;
+                        }
+                        pstmt->need_on = en_NullProc;
+                        break;
+
+                case SQL_SUCCESS:
+                case SQL_SUCCESS_WITH_INFO:
+                        switch( pstmt->state )
+                        {
+                                case en_stmt_needdata:
+                                        pstmt->state = en_stmt_mustput;
+                                        break;
+
+                                case en_stmt_canput:
+                                        switch( pstmt->need_on )
+                                        {
+                                                case en_SetPos:
+                                                        pstmt->state
+                                                        = en_stmt_xfetched;
+                                                        pstmt->cursor_state
+                                                        = en_stmt_cursor_xfetched;
+                                                        break;
+
+                                                case en_ExecDirect:
+                                                case en_Execute:
+                                                        do_cursoropen(hstmt);
+                                                        break;
+
+                                                default:
+                                                        break;
+                                        }
+                                        break;
+
+                                default:
+                                        break;
+                        }
+                        pstmt->need_on = en_NullProc;
+                        break;
+
+                case SQL_NEED_DATA:
+                        pstmt->state = en_stmt_mustput;
+                        break;
+
+                default:
+                        break;
+        }
+
+        return retcode;
 }
 
 
-RETCODE SQL_API        SQLNumParams (
-                       HSTMT           hstmt,
-                       SWORD FAR*      pcpar )
+RETCODE SQL_API SQLNumParams (
+                        HSTMT           hstmt,
+                        SWORD FAR*      pcpar )
 {
-       STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
-       HPROC           hproc;
-       RETCODE         retcode;
-
-       if( hstmt == SQL_NULL_HSTMT
-        || pstmt->hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       /* check argument */
-
-       /* check state */
-       if( pstmt->asyn_on == en_NullProc )
-       {
-               switch( pstmt->state )
-               {
-                       case en_stmt_allocated:
-                       case en_stmt_needdata:
-                       case en_stmt_mustput:
-                       case en_stmt_canput:
-                               PUSHSQLERR ( pstmt->herr, en_S1010 );
-                               return SQL_ERROR;
-       
-                       default:
-                               break;
-               }
-       }
-       else if( pstmt->asyn_on != en_NumParams )
-       {
-               PUSHSQLERR ( pstmt->herr, en_S1010 );
-               
-               return SQL_ERROR;
-       }
-
-       /* call driver */
-       hproc = _iodbcdm_getproc ( pstmt->hdbc, en_NumParams );
-
-       if( hproc == SQL_NULL_HPROC )
-       {
-               PUSHSQLERR ( pstmt->herr, en_IM001 );
-
-               return SQL_ERROR;
-       }
-       
-       CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_NumParams, (
-                       pstmt->dhstmt, pcpar) )
+        STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
+        HPROC           hproc;
+        RETCODE         retcode;
+
+        if( hstmt == SQL_NULL_HSTMT
+         || pstmt->hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        /* check argument */
+
+        /* check state */
+        if( pstmt->asyn_on == en_NullProc )
+        {
+                switch( pstmt->state )
+                {
+                        case en_stmt_allocated:
+                        case en_stmt_needdata:
+                        case en_stmt_mustput:
+                        case en_stmt_canput:
+                                PUSHSQLERR ( pstmt->herr, en_S1010 );
+                                return SQL_ERROR;
+
+                        default:
+                                break;
+                }
+        }
+        else if( pstmt->asyn_on != en_NumParams )
+        {
+                PUSHSQLERR ( pstmt->herr, en_S1010 );
+
+                return SQL_ERROR;
+        }
+
+        /* call driver */
+        hproc = _iodbcdm_getproc ( pstmt->hdbc, en_NumParams );
+
+        if( hproc == SQL_NULL_HPROC )
+        {
+                PUSHSQLERR ( pstmt->herr, en_IM001 );
+
+                return SQL_ERROR;
+        }
+
+        CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_NumParams, (
+                        pstmt->dhstmt, pcpar) )
 
 
 #if 0
-       retcode = hproc ( pstmt->dhstmt, pcpar );
+        retcode = hproc ( pstmt->dhstmt, pcpar );
 #endif
 
-       /* state transition */
-       if( pstmt->asyn_on == en_NumParams )
-       {
-               switch ( retcode )
-               {
-                       case SQL_SUCCESS:
-                       case SQL_SUCCESS_WITH_INFO:
-                       case SQL_ERROR:
-                               break;
-
-                       default:
-                               return retcode;
-               }
-       }
-
-       if( retcode == SQL_STILL_EXECUTING )
-       {
-               pstmt->asyn_on = en_NumParams;
-       }
-
-       return retcode;
+        /* state transition */
+        if( pstmt->asyn_on == en_NumParams )
+        {
+                switch ( retcode )
+                {
+                        case SQL_SUCCESS:
+                        case SQL_SUCCESS_WITH_INFO:
+                        case SQL_ERROR:
+                                break;
+
+                        default:
+                                return retcode;
+                }
+        }
+
+        if( retcode == SQL_STILL_EXECUTING )
+        {
+                pstmt->asyn_on = en_NumParams;
+        }
+
+        return retcode;
 }
 
-RETCODE SQL_API        SQLDescribeParam (
-                       HSTMT           hstmt,
-                       UWORD           ipar,
-                       SWORD  FAR*     pfSqlType,
-                       UDWORD FAR*     pcbColDef,
-                       SWORD  FAR*     pibScale,
-                       SWORD  FAR*     pfNullable )
+RETCODE SQL_API SQLDescribeParam (
+                        HSTMT           hstmt,
+                        UWORD           ipar,
+                        SWORD  FAR*     pfSqlType,
+                        UDWORD FAR*     pcbColDef,
+                        SWORD  FAR*     pibScale,
+                        SWORD  FAR*     pfNullable )
 {
-       STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
-       HPROC           hproc;
-       RETCODE         retcode;
-
-       if( hstmt == SQL_NULL_HSTMT
-        || pstmt->hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       /* check argument */
-       if( ipar == 0 )
-       {
-               PUSHSQLERR ( pstmt->herr, en_S1093 );
-
-               return SQL_ERROR;
-       }
-
-       /* check state */
-       if( pstmt->asyn_on == en_NullProc )
-       {
-               switch( pstmt->state )
-               {
-                       case en_stmt_allocated:
-                       case en_stmt_needdata:
-                       case en_stmt_mustput:
-                       case en_stmt_canput:
-                               PUSHSQLERR ( pstmt->herr, en_S1010 );
-                               return SQL_ERROR;
-       
-                       default:
-                               break;
-               }
-       }
-       else if( pstmt->asyn_on != en_DescribeParam )
-       {
-               PUSHSQLERR ( pstmt->herr, en_S1010 );
-               
-               return SQL_ERROR;
-       }
-
-       /* call driver */
-       hproc = _iodbcdm_getproc ( pstmt->hdbc, en_DescribeParam );
-
-       if( hproc == SQL_NULL_HPROC )
-       {
-               PUSHSQLERR ( pstmt->herr, en_IM001 );
-
-               return SQL_ERROR;
-       }
-
-       CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_DescribeParam, (
-                       pstmt->dhstmt, 
-                       ipar,
-                       pfSqlType,
-                       pcbColDef,
-                       pibScale,
-                       pfNullable ) )
+        STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
+        HPROC           hproc;
+        RETCODE         retcode;
+
+        if( hstmt == SQL_NULL_HSTMT
+         || pstmt->hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        /* check argument */
+        if( ipar == 0 )
+        {
+                PUSHSQLERR ( pstmt->herr, en_S1093 );
+
+                return SQL_ERROR;
+        }
+
+        /* check state */
+        if( pstmt->asyn_on == en_NullProc )
+        {
+                switch( pstmt->state )
+                {
+                        case en_stmt_allocated:
+                        case en_stmt_needdata:
+                        case en_stmt_mustput:
+                        case en_stmt_canput:
+                                PUSHSQLERR ( pstmt->herr, en_S1010 );
+                                return SQL_ERROR;
+
+                        default:
+                                break;
+                }
+        }
+        else if( pstmt->asyn_on != en_DescribeParam )
+        {
+                PUSHSQLERR ( pstmt->herr, en_S1010 );
+
+                return SQL_ERROR;
+        }
+
+        /* call driver */
+        hproc = _iodbcdm_getproc ( pstmt->hdbc, en_DescribeParam );
+
+        if( hproc == SQL_NULL_HPROC )
+        {
+                PUSHSQLERR ( pstmt->herr, en_IM001 );
+
+                return SQL_ERROR;
+        }
+
+        CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_DescribeParam, (
+                        pstmt->dhstmt,
+                        ipar,
+                        pfSqlType,
+                        pcbColDef,
+                        pibScale,
+                        pfNullable ) )
 
 #if 0
-       retcode = hproc(pstmt->dhstmt, 
-                       ipar,
-                       pfSqlType,
-                       pcbColDef,
-                       pibScale,
-                       pfNullable );
+        retcode = hproc(pstmt->dhstmt,
+                        ipar,
+                        pfSqlType,
+                        pcbColDef,
+                        pibScale,
+                        pfNullable );
 #endif
 
-       /* state transition */
-       if( pstmt->asyn_on == en_DescribeParam )
-       {
-               switch ( retcode )
-               {
-                       case SQL_SUCCESS:
-                       case SQL_SUCCESS_WITH_INFO:
-                       case SQL_ERROR:
-                               break;
-
-                       default:
-                               return retcode;
-               }
-       }
-
-       if( retcode == SQL_STILL_EXECUTING )
-       {
-               pstmt->asyn_on = en_DescribeParam;
-       }
-
-       return retcode;
+        /* state transition */
+        if( pstmt->asyn_on == en_DescribeParam )
+        {
+                switch ( retcode )
+                {
+                        case SQL_SUCCESS:
+                        case SQL_SUCCESS_WITH_INFO:
+                        case SQL_ERROR:
+                                break;
+
+                        default:
+                                return retcode;
+                }
+        }
+
+        if( retcode == SQL_STILL_EXECUTING )
+        {
+                pstmt->asyn_on = en_DescribeParam;
+        }
+
+        return retcode;
 }
index 85bd13e59ff3845744d5e964b63d3a9cd99f3913..d7c8db3e503232308e97c750b6bbabd5d208bf45 100644 (file)
@@ -1,6 +1,6 @@
 /** Fetch query result
-       
-    Copyright (C) 1995 by Ke Jin <kejin@empress.com> 
+
+    Copyright (C) 1995 by Ke Jin <kejin@empress.com>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     GNU General Public License for more details.
 **/
 
-#include       <../iodbc/iodbc.h>
+#include        <config.h>
 
-#include       <../iodbc/isql.h>
-#include       <../iodbc/isqlext.h>
+#include        <isql.h>
+#include        <isqlext.h>
 
-#include        <../iodbc/dlproc.h>
+#include        <dlproc.h>
 
-#include       <../iodbc/herr.h>
-#include       <../iodbc/henv.h>
-#include       <../iodbc/hdbc.h>
-#include       <../iodbc/hstmt.h>
+#include        <herr.h>
+#include        <henv.h>
+#include        <hdbc.h>
+#include        <hstmt.h>
 
-#include       <../iodbc/itrace.h>
+#include        <itrace.h>
 
-RETCODE SQL_API        SQLFetch ( HSTMT hstmt )
+RETCODE SQL_API SQLFetch ( HSTMT hstmt )
 {
-       STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
-       HPROC           hproc   = SQL_NULL_HPROC;
-       RETCODE         retcode;
-
-       if( hstmt == SQL_NULL_HSTMT 
-        || pstmt->hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       /* check state */
-       if( pstmt->asyn_on == en_NullProc )
-       {
-               switch( pstmt->state )
-               {
-                       case en_stmt_allocated:
-                       case en_stmt_prepared:
-                       case en_stmt_xfetched:
-                       case en_stmt_needdata:
-                       case en_stmt_mustput:
-                       case en_stmt_canput:
-                               PUSHSQLERR ( pstmt->herr, en_S1010 );
-                               return SQL_ERROR;
-       
-                       default:
-                               break;
-               }
-       }
-       else if( pstmt->asyn_on != en_Fetch )
-       {
-               PUSHSQLERR ( pstmt->herr, en_S1010 );
-               return SQL_ERROR;
-       }
-
-       hproc = _iodbcdm_getproc( pstmt->hdbc, en_Fetch );
-
-       if( hproc == SQL_NULL_HPROC )
-       {
-               PUSHSQLERR ( pstmt->herr, en_IM001 );
-               
-               return SQL_ERROR;
-       }
-
-       CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_Fetch, (pstmt->dhstmt) )
+        STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
+        HPROC           hproc   = SQL_NULL_HPROC;
+        RETCODE         retcode;
+
+        if( hstmt == SQL_NULL_HSTMT
+         || pstmt->hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        /* check state */
+        if( pstmt->asyn_on == en_NullProc )
+        {
+                switch( pstmt->state )
+                {
+                        case en_stmt_allocated:
+                        case en_stmt_prepared:
+                        case en_stmt_xfetched:
+                        case en_stmt_needdata:
+                        case en_stmt_mustput:
+                        case en_stmt_canput:
+                                PUSHSQLERR ( pstmt->herr, en_S1010 );
+                                return SQL_ERROR;
+
+                        default:
+                                break;
+                }
+        }
+        else if( pstmt->asyn_on != en_Fetch )
+        {
+                PUSHSQLERR ( pstmt->herr, en_S1010 );
+                return SQL_ERROR;
+        }
+
+        hproc = _iodbcdm_getproc( pstmt->hdbc, en_Fetch );
+
+        if( hproc == SQL_NULL_HPROC )
+        {
+                PUSHSQLERR ( pstmt->herr, en_IM001 );
+
+                return SQL_ERROR;
+        }
+
+        CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_Fetch, (pstmt->dhstmt) )
 
 #if 0
-       retcode = hproc( pstmt->dhstmt );
+        retcode = hproc( pstmt->dhstmt );
 #endif
-       /* state transition */
-       if( pstmt->asyn_on == en_Fetch )
-       {
-               switch( retcode )
-               {
-                       case SQL_SUCCESS:
-                       case SQL_SUCCESS_WITH_INFO:
-                       case SQL_NO_DATA_FOUND:
-                       case SQL_ERROR:
-                               pstmt->asyn_on = en_NullProc;
-                               break;
-
-                       case SQL_STILL_EXECUTING:
-                       default:
-                               return retcode;
-               }
-       }
-
-       switch( pstmt->state )
-       {
-               case en_stmt_cursoropen:
-               case en_stmt_fetched:
-                       switch( retcode )
-                       {
-                               case SQL_SUCCESS:
-                               case SQL_SUCCESS_WITH_INFO:
-                                       pstmt->state = en_stmt_fetched;
-                                       pstmt->cursor_state = en_stmt_cursor_fetched;
-                                       break;
-
-                               case SQL_NO_DATA_FOUND:
-                                       if( pstmt->prep_state )
-                                       {
-                                               pstmt->state = en_stmt_prepared;
-                                       }
-                                       else
-                                       {
-
-                                               pstmt->state = en_stmt_allocated;
-                                       }       
-                                       pstmt->cursor_state = en_stmt_cursor_no;
-                                       break;
-                               
-                               case SQL_STILL_EXECUTING:
-                                       pstmt->asyn_on = en_Fetch;
-                                       break;
-
-                               default:
-                                       break;
-                       }
-                       break;
-
-               default:
-                       break;
-       }
-
-       return retcode;
+        /* state transition */
+        if( pstmt->asyn_on == en_Fetch )
+        {
+                switch( retcode )
+                {
+                        case SQL_SUCCESS:
+                        case SQL_SUCCESS_WITH_INFO:
+                        case SQL_NO_DATA_FOUND:
+                        case SQL_ERROR:
+                                pstmt->asyn_on = en_NullProc;
+                                break;
+
+                        case SQL_STILL_EXECUTING:
+                        default:
+                                return retcode;
+                }
+        }
+
+        switch( pstmt->state )
+        {
+                case en_stmt_cursoropen:
+                case en_stmt_fetched:
+                        switch( retcode )
+                        {
+                                case SQL_SUCCESS:
+                                case SQL_SUCCESS_WITH_INFO:
+                                        pstmt->state = en_stmt_fetched;
+                                        pstmt->cursor_state = en_stmt_cursor_fetched;
+                                        break;
+
+                                case SQL_NO_DATA_FOUND:
+                                        if( pstmt->prep_state )
+                                        {
+                                                pstmt->state = en_stmt_prepared;
+                                        }
+                                        else
+                                        {
+
+                                                pstmt->state = en_stmt_allocated;
+                                        }
+                                        pstmt->cursor_state = en_stmt_cursor_no;
+                                        break;
+
+                                case SQL_STILL_EXECUTING:
+                                        pstmt->asyn_on = en_Fetch;
+                                        break;
+
+                                default:
+                                        break;
+                        }
+                        break;
+
+                default:
+                        break;
+        }
+
+        return retcode;
 }
 
-RETCODE SQL_API        SQLExtendedFetch ( 
-                       HSTMT           hstmt,
-                       UWORD           fFetchType,
-                       SDWORD          irow,
-                       UDWORD FAR*     pcrow,
-                       UWORD  FAR*     rgfRowStatus )
+RETCODE SQL_API SQLExtendedFetch (
+                        HSTMT           hstmt,
+                        UWORD           fFetchType,
+                        SDWORD          irow,
+                        UDWORD FAR*     pcrow,
+                        UWORD  FAR*     rgfRowStatus )
 {
-       STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
-       HPROC           hproc   = SQL_NULL_HPROC;
-       RETCODE         retcode;
-
-       if( hstmt == SQL_NULL_HSTMT 
-        || pstmt->hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       /* check fetch type */
-       if( fFetchType < SQL_FETCH_NEXT
-        || fFetchType > SQL_FETCH_BOOKMARK )
-       {
-               /* Unlike MS driver manager(i.e. DM),
-                * we don't check driver's ODBC version 
-                * against SQL_FETCH_RESUME (only 1.0)
-                * and SQL_FETCH_BOOKMARK (only 2.0).
-                */
-               PUSHSQLERR ( pstmt->herr, en_S1106 );
-               
-               return SQL_ERROR;
-       }
-
-       /* check state */
-       if( pstmt->asyn_on == en_NullProc )
-       {
-               switch( pstmt->state )
-               {
-                       case en_stmt_allocated:
-                       case en_stmt_prepared:
-                       case en_stmt_fetched:
-                       case en_stmt_needdata:
-                       case en_stmt_mustput:
-                       case en_stmt_canput:
-                               PUSHSQLERR ( pstmt->herr, en_S1010 );
-                               return SQL_ERROR;
-       
-                       default:
-                               break;
-               }
-       }
-       else if( pstmt->asyn_on != en_ExtendedFetch )
-       {
-               PUSHSQLERR ( pstmt->herr, en_S1010 );
-               return SQL_ERROR;
-       }
-
-       hproc = _iodbcdm_getproc( pstmt->hdbc, en_ExtendedFetch );
-
-       if( hproc == SQL_NULL_HPROC )
-       {
-               PUSHSQLERR ( pstmt->herr, en_IM001 );
-               
-               return SQL_ERROR;
-       }
-
-       CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_ExtendedFetch, (
-                       pstmt->dhstmt, 
-                       fFetchType,
-                       irow,
-                       pcrow,
-                       rgfRowStatus ) )
+        STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
+        HPROC           hproc   = SQL_NULL_HPROC;
+        RETCODE         retcode;
+
+        if( hstmt == SQL_NULL_HSTMT
+         || pstmt->hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        /* check fetch type */
+        if( fFetchType < SQL_FETCH_NEXT
+         || fFetchType > SQL_FETCH_BOOKMARK )
+        {
+                /* Unlike MS driver manager(i.e. DM),
+                 * we don't check driver's ODBC version
+                 * against SQL_FETCH_RESUME (only 1.0)
+                 * and SQL_FETCH_BOOKMARK (only 2.0).
+                 */
+                PUSHSQLERR ( pstmt->herr, en_S1106 );
+
+                return SQL_ERROR;
+        }
+
+        /* check state */
+        if( pstmt->asyn_on == en_NullProc )
+        {
+                switch( pstmt->state )
+                {
+                        case en_stmt_allocated:
+                        case en_stmt_prepared:
+                        case en_stmt_fetched:
+                        case en_stmt_needdata:
+                        case en_stmt_mustput:
+                        case en_stmt_canput:
+                                PUSHSQLERR ( pstmt->herr, en_S1010 );
+                                return SQL_ERROR;
+
+                        default:
+                                break;
+                }
+        }
+        else if( pstmt->asyn_on != en_ExtendedFetch )
+        {
+                PUSHSQLERR ( pstmt->herr, en_S1010 );
+                return SQL_ERROR;
+        }
+
+        hproc = _iodbcdm_getproc( pstmt->hdbc, en_ExtendedFetch );
+
+        if( hproc == SQL_NULL_HPROC )
+        {
+                PUSHSQLERR ( pstmt->herr, en_IM001 );
+
+                return SQL_ERROR;
+        }
+
+        CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_ExtendedFetch, (
+                        pstmt->dhstmt,
+                        fFetchType,
+                        irow,
+                        pcrow,
+                        rgfRowStatus ) )
 
 #if 0
-       retcode = hproc(pstmt->dhstmt, 
-                       fFetchType,
-                       irow,
-                       pcrow,
-                       rgfRowStatus );
+        retcode = hproc(pstmt->dhstmt,
+                        fFetchType,
+                        irow,
+                        pcrow,
+                        rgfRowStatus );
 #endif
 
-       /* state transition */
-       if( pstmt->asyn_on == en_ExtendedFetch )
-       {
-               switch( retcode )
-               {
-                       case SQL_SUCCESS:
-                       case SQL_SUCCESS_WITH_INFO:
-                       case SQL_NO_DATA_FOUND:
-                       case SQL_ERROR:
-                               pstmt->asyn_on = en_NullProc;
-                               break;
-
-                       case SQL_STILL_EXECUTING:
-                       default:
-                               return retcode;
-               }
-       }
-
-       switch( pstmt->state )
-       {
-               case en_stmt_cursoropen:
-               case en_stmt_xfetched:
-                       switch( retcode )
-                       {
-                               case SQL_SUCCESS:
-                               case SQL_SUCCESS_WITH_INFO:
-                               case SQL_NO_DATA_FOUND:
-                                       pstmt->state = en_stmt_xfetched;
-                                       pstmt->cursor_state = en_stmt_cursor_xfetched;
-                                       break;
-                               
-                               case SQL_STILL_EXECUTING:
-                                       pstmt->asyn_on = en_ExtendedFetch;
-                                       break;
-
-                               default:
-                                       break;
-                       }
-                       break;
-
-               default:
-                       break;
-       }
-
-       return retcode;
+        /* state transition */
+        if( pstmt->asyn_on == en_ExtendedFetch )
+        {
+                switch( retcode )
+                {
+                        case SQL_SUCCESS:
+                        case SQL_SUCCESS_WITH_INFO:
+                        case SQL_NO_DATA_FOUND:
+                        case SQL_ERROR:
+                                pstmt->asyn_on = en_NullProc;
+                                break;
+
+                        case SQL_STILL_EXECUTING:
+                        default:
+                                return retcode;
+                }
+        }
+
+        switch( pstmt->state )
+        {
+                case en_stmt_cursoropen:
+                case en_stmt_xfetched:
+                        switch( retcode )
+                        {
+                                case SQL_SUCCESS:
+                                case SQL_SUCCESS_WITH_INFO:
+                                case SQL_NO_DATA_FOUND:
+                                        pstmt->state = en_stmt_xfetched;
+                                        pstmt->cursor_state = en_stmt_cursor_xfetched;
+                                        break;
+
+                                case SQL_STILL_EXECUTING:
+                                        pstmt->asyn_on = en_ExtendedFetch;
+                                        break;
+
+                                default:
+                                        break;
+                        }
+                        break;
+
+                default:
+                        break;
+        }
+
+        return retcode;
 }
 
-RETCODE SQL_API        SQLGetData(
-                       HSTMT           hstmt,
-                       UWORD           icol,
-                       SWORD           fCType,
-                       PTR             rgbValue,
-                       SDWORD          cbValueMax,
-                       SDWORD FAR*     pcbValue )
+RETCODE SQL_API SQLGetData(
+                        HSTMT           hstmt,
+                        UWORD           icol,
+                        SWORD           fCType,
+                        PTR             rgbValue,
+                        SDWORD          cbValueMax,
+                        SDWORD FAR*     pcbValue )
 {
-       STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
-       HPROC           hproc;
-       RETCODE         retcode;
-       int             sqlstat = en_00000;
-
-       if( hstmt == SQL_NULL_HSTMT
-        || pstmt->hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       /* check argument */
-       if( rgbValue == NULL )
-       {
-               sqlstat = en_S1009;
-       }
-       else if( cbValueMax < 0 )
-       {
-               sqlstat = en_S1090;
-       }
-       else 
-       {
-               switch(fCType)
-               {
-                       case SQL_C_DEFAULT:
-                       case SQL_C_CHAR:
-                       case SQL_C_BINARY:
-                       case SQL_C_BIT:
-                       case SQL_C_TINYINT:
-                       case SQL_C_STINYINT:
-                       case SQL_C_UTINYINT:
-                       case SQL_C_SHORT:
-                       case SQL_C_SSHORT:
-                       case SQL_C_USHORT:
-                       case SQL_C_LONG:
-                       case SQL_C_SLONG:
-                       case SQL_C_ULONG:
-                       case SQL_C_FLOAT:
-                       case SQL_C_DOUBLE:
-                       case SQL_C_DATE:
-                       case SQL_C_TIME:
-                       case SQL_C_TIMESTAMP:
-                               break;
-
-                       default:
-                               sqlstat = en_S1003;
-                               break;
-               }
-       }
-
-       if( sqlstat != en_00000 )
-       {
-               PUSHSQLERR ( pstmt->herr, sqlstat );
-
-               return SQL_ERROR;
-       }
-
-       /* check state */
-       if( pstmt->asyn_on == en_NullProc )
-       {
-               switch( pstmt->state )
-               {
-                       case en_stmt_allocated:
-                       case en_stmt_prepared:
-                       case en_stmt_needdata:
-                       case en_stmt_mustput:
-                       case en_stmt_canput:
-                               sqlstat = en_S1010;
-                               break;
-                       
-                       case en_stmt_executed:
-                       case en_stmt_cursoropen:
-                               sqlstat = en_24000;
-                               break;
-
-                       default:
-                               break;
-               }
-       }
-       else if( pstmt->asyn_on != en_GetData )
-       {
-               sqlstat = en_S1010;
-       }
-
-       if( sqlstat != en_00000 )
-       {
-               PUSHSQLERR ( pstmt->herr, sqlstat );
-
-               return SQL_ERROR;
-       }
-
-       /* call driver */
-       hproc = _iodbcdm_getproc( pstmt->hdbc, en_GetData );
-
-       if( hproc == SQL_NULL_HPROC )
-       {
-               PUSHSQLERR ( pstmt->herr, en_IM001 );
-
-               return SQL_ERROR;
-       }
-
-       CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_GetData, (
-                       pstmt->dhstmt,
-                       icol,
-                       fCType,
-                       rgbValue,
-                       cbValueMax,
-                       pcbValue ) )
+        STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
+        HPROC           hproc;
+        RETCODE         retcode;
+        int             sqlstat = en_00000;
+
+        if( hstmt == SQL_NULL_HSTMT
+         || pstmt->hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        /* check argument */
+        if( rgbValue == NULL )
+        {
+                sqlstat = en_S1009;
+        }
+        else if( cbValueMax < 0 )
+        {
+                sqlstat = en_S1090;
+        }
+        else
+        {
+                switch(fCType)
+                {
+                        case SQL_C_DEFAULT:
+                        case SQL_C_CHAR:
+                        case SQL_C_BINARY:
+                        case SQL_C_BIT:
+                        case SQL_C_TINYINT:
+                        case SQL_C_STINYINT:
+                        case SQL_C_UTINYINT:
+                        case SQL_C_SHORT:
+                        case SQL_C_SSHORT:
+                        case SQL_C_USHORT:
+                        case SQL_C_LONG:
+                        case SQL_C_SLONG:
+                        case SQL_C_ULONG:
+                        case SQL_C_FLOAT:
+                        case SQL_C_DOUBLE:
+                        case SQL_C_DATE:
+                        case SQL_C_TIME:
+                        case SQL_C_TIMESTAMP:
+                                break;
+
+                        default:
+                                sqlstat = en_S1003;
+                                break;
+                }
+        }
+
+        if( sqlstat != en_00000 )
+        {
+                PUSHSQLERR ( pstmt->herr, sqlstat );
+
+                return SQL_ERROR;
+        }
+
+        /* check state */
+        if( pstmt->asyn_on == en_NullProc )
+        {
+                switch( pstmt->state )
+                {
+                        case en_stmt_allocated:
+                        case en_stmt_prepared:
+                        case en_stmt_needdata:
+                        case en_stmt_mustput:
+                        case en_stmt_canput:
+                                sqlstat = en_S1010;
+                                break;
+
+                        case en_stmt_executed:
+                        case en_stmt_cursoropen:
+                                sqlstat = en_24000;
+                                break;
+
+                        default:
+                                break;
+                }
+        }
+        else if( pstmt->asyn_on != en_GetData )
+        {
+                sqlstat = en_S1010;
+        }
+
+        if( sqlstat != en_00000 )
+        {
+                PUSHSQLERR ( pstmt->herr, sqlstat );
+
+                return SQL_ERROR;
+        }
+
+        /* call driver */
+        hproc = _iodbcdm_getproc( pstmt->hdbc, en_GetData );
+
+        if( hproc == SQL_NULL_HPROC )
+        {
+                PUSHSQLERR ( pstmt->herr, en_IM001 );
+
+                return SQL_ERROR;
+        }
+
+        CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_GetData, (
+                        pstmt->dhstmt,
+                        icol,
+                        fCType,
+                        rgbValue,
+                        cbValueMax,
+                        pcbValue ) )
 
 #if 0
-       retcode = hproc(pstmt->dhstmt,
-                       icol,
-                       fCType,
-                       rgbValue,
-                       cbValueMax,
-                       pcbValue );
+        retcode = hproc(pstmt->dhstmt,
+                        icol,
+                        fCType,
+                        rgbValue,
+                        cbValueMax,
+                        pcbValue );
 #endif
 
-       /* state transition */
-       if( pstmt->asyn_on == en_GetData )
-       {
-               switch ( retcode )
-               {
-                       case SQL_SUCCESS:
-                       case SQL_SUCCESS_WITH_INFO:
-                       case SQL_NO_DATA_FOUND:
-                       case SQL_ERROR:
-                               pstmt->asyn_on = en_NullProc;
-                               break;
-
-                       case SQL_STILL_EXECUTING:
-                       default:
-                               return retcode;
-               }
-       }
-
-       switch( pstmt->state )
-       {
-               case en_stmt_fetched:
-               case en_stmt_xfetched:
-                       if( retcode == SQL_STILL_EXECUTING )
-                       {
-                               pstmt->asyn_on = en_GetData;
-                               break;
-                       }
-                       break;
-
-               default:
-                       break;
-       }
-
-       return retcode;
+        /* state transition */
+        if( pstmt->asyn_on == en_GetData )
+        {
+                switch ( retcode )
+                {
+                        case SQL_SUCCESS:
+                        case SQL_SUCCESS_WITH_INFO:
+                        case SQL_NO_DATA_FOUND:
+                        case SQL_ERROR:
+                                pstmt->asyn_on = en_NullProc;
+                                break;
+
+                        case SQL_STILL_EXECUTING:
+                        default:
+                                return retcode;
+                }
+        }
+
+        switch( pstmt->state )
+        {
+                case en_stmt_fetched:
+                case en_stmt_xfetched:
+                        if( retcode == SQL_STILL_EXECUTING )
+                        {
+                                pstmt->asyn_on = en_GetData;
+                                break;
+                        }
+                        break;
+
+                default:
+                        break;
+        }
+
+        return retcode;
 }
 
-RETCODE SQL_API        SQLMoreResults( HSTMT   hstmt )
+RETCODE SQL_API SQLMoreResults( HSTMT   hstmt )
 {
-       STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
-       HPROC           hproc;
-       RETCODE         retcode;
-
-       if( hstmt == SQL_NULL_HSTMT
-        || pstmt->hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       /* check state */
-       if( pstmt->asyn_on == en_NullProc )
-       {
-               switch( pstmt->state )
-               {
-                       case en_stmt_allocated:
-                       case en_stmt_prepared:
-                               return SQL_NO_DATA_FOUND;
-
-                       case en_stmt_needdata:
-                       case en_stmt_mustput:
-                       case en_stmt_canput:
-                               PUSHSQLERR ( pstmt->herr, en_S1010 );
-                               return SQL_ERROR;
-
-                       default:
-                               break;
-               }
-       }
-       else if( pstmt->asyn_on != en_MoreResults )
-       {
-               PUSHSQLERR ( pstmt->herr, en_S1010 );
-
-               return SQL_ERROR;
-       }
-
-       /* call driver */
-       hproc = _iodbcdm_getproc( pstmt->hdbc, en_MoreResults );
-
-       if( hproc == SQL_NULL_HPROC )
-       {
-               PUSHSQLERR ( pstmt->herr, en_IM001 );
-
-               return SQL_ERROR;
-       }
-
-       CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_MoreResults, (pstmt->dhstmt) )
+        STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
+        HPROC           hproc;
+        RETCODE         retcode;
+
+        if( hstmt == SQL_NULL_HSTMT
+         || pstmt->hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        /* check state */
+        if( pstmt->asyn_on == en_NullProc )
+        {
+                switch( pstmt->state )
+                {
+                        case en_stmt_allocated:
+                        case en_stmt_prepared:
+                                return SQL_NO_DATA_FOUND;
+
+                        case en_stmt_needdata:
+                        case en_stmt_mustput:
+                        case en_stmt_canput:
+                                PUSHSQLERR ( pstmt->herr, en_S1010 );
+                                return SQL_ERROR;
+
+                        default:
+                                break;
+                }
+        }
+        else if( pstmt->asyn_on != en_MoreResults )
+        {
+                PUSHSQLERR ( pstmt->herr, en_S1010 );
+
+                return SQL_ERROR;
+        }
+
+        /* call driver */
+        hproc = _iodbcdm_getproc( pstmt->hdbc, en_MoreResults );
+
+        if( hproc == SQL_NULL_HPROC )
+        {
+                PUSHSQLERR ( pstmt->herr, en_IM001 );
+
+                return SQL_ERROR;
+        }
+
+        CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_MoreResults, (pstmt->dhstmt) )
 
 #if 0
-       retcode = hproc( pstmt->dhstmt );
+        retcode = hproc( pstmt->dhstmt );
 #endif
 
-       /* state transition */
-       if( pstmt->asyn_on == en_MoreResults )
-       {
-               switch( retcode )
-               {
-                       case SQL_SUCCESS:
-                       case SQL_SUCCESS_WITH_INFO:
-                       case SQL_NO_DATA_FOUND:
-                       case SQL_ERROR:
-                               pstmt->asyn_on = en_NullProc;
-                               break;
-
-                       case SQL_STILL_EXECUTING:
-                       default:
-                               return retcode;
-               }
-       }
-
-       switch( pstmt->state )
-       {
-               case en_stmt_allocated:
-               case en_stmt_prepared:
-                       /* driver should return SQL_NO_DATA_FOUND */
-                       break;
-
-               case en_stmt_executed:
-                       if( retcode == SQL_NO_DATA_FOUND )
-                       {
-                               if( pstmt->prep_state )
-                               {
-                                       pstmt->state = en_stmt_prepared;
-                               }
-                               else
-                               {
-                                       pstmt->state = en_stmt_allocated;
-                               }
-                       }
-                       else if( retcode == SQL_STILL_EXECUTING )
-                       {
-                               pstmt->asyn_on = en_MoreResults;
-                       }
-                       break;
-
-               case en_stmt_cursoropen:
-               case en_stmt_fetched:
-               case en_stmt_xfetched:
-                       if( retcode == SQL_SUCCESS )
-                       {
-                               break;
-                       } 
-                       else if( retcode == SQL_NO_DATA_FOUND )
-                       {
-                               if( pstmt->prep_state )
-                               {
-                                       pstmt->state = en_stmt_prepared;
-                               }
-                               else
-                               {
-                                       pstmt->state = en_stmt_allocated;
-                               }
-                       }
-                       else if( retcode == SQL_STILL_EXECUTING )
-                       {
-                               pstmt->asyn_on = en_MoreResults;
-                       }
-                       break;
-
-               default:
-                       break;
-       }
-
-       return retcode;
+        /* state transition */
+        if( pstmt->asyn_on == en_MoreResults )
+        {
+                switch( retcode )
+                {
+                        case SQL_SUCCESS:
+                        case SQL_SUCCESS_WITH_INFO:
+                        case SQL_NO_DATA_FOUND:
+                        case SQL_ERROR:
+                                pstmt->asyn_on = en_NullProc;
+                                break;
+
+                        case SQL_STILL_EXECUTING:
+                        default:
+                                return retcode;
+                }
+        }
+
+        switch( pstmt->state )
+        {
+                case en_stmt_allocated:
+                case en_stmt_prepared:
+                        /* driver should return SQL_NO_DATA_FOUND */
+                        break;
+
+                case en_stmt_executed:
+                        if( retcode == SQL_NO_DATA_FOUND )
+                        {
+                                if( pstmt->prep_state )
+                                {
+                                        pstmt->state = en_stmt_prepared;
+                                }
+                                else
+                                {
+                                        pstmt->state = en_stmt_allocated;
+                                }
+                        }
+                        else if( retcode == SQL_STILL_EXECUTING )
+                        {
+                                pstmt->asyn_on = en_MoreResults;
+                        }
+                        break;
+
+                case en_stmt_cursoropen:
+                case en_stmt_fetched:
+                case en_stmt_xfetched:
+                        if( retcode == SQL_SUCCESS )
+                        {
+                                break;
+                        }
+                        else if( retcode == SQL_NO_DATA_FOUND )
+                        {
+                                if( pstmt->prep_state )
+                                {
+                                        pstmt->state = en_stmt_prepared;
+                                }
+                                else
+                                {
+                                        pstmt->state = en_stmt_allocated;
+                                }
+                        }
+                        else if( retcode == SQL_STILL_EXECUTING )
+                        {
+                                pstmt->asyn_on = en_MoreResults;
+                        }
+                        break;
+
+                default:
+                        break;
+        }
+
+        return retcode;
 }
 
-RETCODE SQL_API        SQLSetPos ( 
-                       HSTMT   hstmt,
-                       UWORD   irow,
-                       UWORD   fOption,
-                       UWORD   fLock )
+RETCODE SQL_API SQLSetPos (
+                        HSTMT   hstmt,
+                        UWORD   irow,
+                        UWORD   fOption,
+                        UWORD   fLock )
 {
-       STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
-       HPROC           hproc;
-       RETCODE         retcode;
-       int             sqlstat = en_00000;
-
-       if( hstmt == SQL_NULL_HSTMT 
-        || pstmt->hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       /* check argument value */
-       if( fOption > SQL_ADD 
-        || fLock > SQL_LOCK_UNLOCK )
-       {
-               PUSHSQLERR ( pstmt->herr, en_S1009 );
-       }
-
-       /* check state */
-       if( pstmt->asyn_on == en_NullProc )
-       {
-               switch( pstmt->state )
-               {
-                       case en_stmt_allocated:
-                       case en_stmt_prepared:
-                       case en_stmt_fetched:
-                       case en_stmt_needdata:
-                       case en_stmt_mustput:
-                       case en_stmt_canput:
-                               sqlstat = en_S1010;
-                               break;
-
-                       case en_stmt_executed:
-                       case en_stmt_cursoropen:
-                               sqlstat = en_24000;
-                               break;
-
-                       default:
-                               break;
-               }
-       }
-       else if( pstmt->asyn_on != en_SetPos )
-       {
-               sqlstat = en_S1010;
-       }
-
-       if( sqlstat != en_00000 )
-       {
-               PUSHSQLERR ( pstmt->herr, sqlstat );
-
-               return SQL_ERROR;
-       }
-
-       /* call driver */
-       hproc = _iodbcdm_getproc( pstmt->hdbc, en_SetPos );
-
-       if( hproc == SQL_NULL_HPROC )
-       {
-               PUSHSQLERR ( pstmt->herr, en_IM001 );
-
-               return SQL_ERROR;
-       }
-
-       CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_SetPos, (
-                       pstmt->dhstmt,
-                       irow,
-                       fOption,
-                       fLock ) )
+        STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
+        HPROC           hproc;
+        RETCODE         retcode;
+        int             sqlstat = en_00000;
+
+        if( hstmt == SQL_NULL_HSTMT
+         || pstmt->hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        /* check argument value */
+        if( fOption > SQL_ADD
+         || fLock > SQL_LOCK_UNLOCK )
+        {
+                PUSHSQLERR ( pstmt->herr, en_S1009 );
+        }
+
+        /* check state */
+        if( pstmt->asyn_on == en_NullProc )
+        {
+                switch( pstmt->state )
+                {
+                        case en_stmt_allocated:
+                        case en_stmt_prepared:
+                        case en_stmt_fetched:
+                        case en_stmt_needdata:
+                        case en_stmt_mustput:
+                        case en_stmt_canput:
+                                sqlstat = en_S1010;
+                                break;
+
+                        case en_stmt_executed:
+                        case en_stmt_cursoropen:
+                                sqlstat = en_24000;
+                                break;
+
+                        default:
+                                break;
+                }
+        }
+        else if( pstmt->asyn_on != en_SetPos )
+        {
+                sqlstat = en_S1010;
+        }
+
+        if( sqlstat != en_00000 )
+        {
+                PUSHSQLERR ( pstmt->herr, sqlstat );
+
+                return SQL_ERROR;
+        }
+
+        /* call driver */
+        hproc = _iodbcdm_getproc( pstmt->hdbc, en_SetPos );
+
+        if( hproc == SQL_NULL_HPROC )
+        {
+                PUSHSQLERR ( pstmt->herr, en_IM001 );
+
+                return SQL_ERROR;
+        }
+
+        CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_SetPos, (
+                        pstmt->dhstmt,
+                        irow,
+                        fOption,
+                        fLock ) )
 #if 0
-       retcode = hproc(pstmt->dhstmt,
-                       irow,
-                       fOption,
-                       fLock );
+        retcode = hproc(pstmt->dhstmt,
+                        irow,
+                        fOption,
+                        fLock );
 #endif
 
-       /* state transition */
-       if( pstmt->asyn_on == en_SetPos )
-       {
-               switch( retcode )
-               {
-                       case SQL_SUCCESS:
-                       case SQL_SUCCESS_WITH_INFO:
-                       case SQL_NEED_DATA:
-                       case SQL_ERROR:
-                               pstmt->asyn_on = en_NullProc;
-                               break;
-
-                       case SQL_STILL_EXECUTING:
-                       default:
-                               return retcode;
-               }
-       }
-
-       /* now, the only possible init state is 'xfetched' */
-       switch( retcode )
-       {
-               case SQL_SUCCESS:
-               case SQL_SUCCESS_WITH_INFO:
-                       break;
-
-               case SQL_NEED_DATA:
-                       pstmt->state = en_stmt_needdata;
-                       pstmt->need_on = en_SetPos;
-                       break;
-
-               case SQL_STILL_EXECUTING:
-                       pstmt->asyn_on = en_SetPos;
-                       break;
-
-               default:
-                       break;
-       }
-
-       return retcode;
+        /* state transition */
+        if( pstmt->asyn_on == en_SetPos )
+        {
+                switch( retcode )
+                {
+                        case SQL_SUCCESS:
+                        case SQL_SUCCESS_WITH_INFO:
+                        case SQL_NEED_DATA:
+                        case SQL_ERROR:
+                                pstmt->asyn_on = en_NullProc;
+                                break;
+
+                        case SQL_STILL_EXECUTING:
+                        default:
+                                return retcode;
+                }
+        }
+
+        /* now, the only possible init state is 'xfetched' */
+        switch( retcode )
+        {
+                case SQL_SUCCESS:
+                case SQL_SUCCESS_WITH_INFO:
+                        break;
+
+                case SQL_NEED_DATA:
+                        pstmt->state = en_stmt_needdata;
+                        pstmt->need_on = en_SetPos;
+                        break;
+
+                case SQL_STILL_EXECUTING:
+                        pstmt->asyn_on = en_SetPos;
+                        break;
+
+                default:
+                        break;
+        }
+
+        return retcode;
 }
index 7157480dd1a1a56917bb43de58cb4a4491cf54b4..1d47da84f53a4aa3c1034140f4f2ebc50597f6c9 100644 (file)
@@ -1,6 +1,6 @@
 /** data source connect object management functions
 
-    Copyright (C) 1995 by Ke Jin <kejin@empress.com> 
+    Copyright (C) 1995 by Ke Jin <kejin@empress.com>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 
 extern RETCODE _iodbcdm_driverunload();
 
-RETCODE SQL_API        SQLAllocConnect( 
-                       HENV            henv,
-                       HDBC FAR*       phdbc )
+RETCODE SQL_API SQLAllocConnect(
+                        HENV            henv,
+                        HDBC FAR*       phdbc )
 {
-       GENV_t FAR*     genv = (GENV_t FAR*)henv;
-       DBC_t  FAR*     pdbc;
+        GENV_t FAR*     genv = (GENV_t FAR*)henv;
+        DBC_t  FAR*     pdbc;
 
 #if (ODBCVER >= 0x0300)
-       if( henv == SQL_NULL_HENV 
-        || genv->type != SQL_HANDLE_ENV )
+        if( henv == SQL_NULL_HENV
+         || genv->type != SQL_HANDLE_ENV )
 #else
-       if( henv == SQL_NULL_HENV )
+        if( henv == SQL_NULL_HENV )
 #endif
-       {
-               return SQL_INVALID_HANDLE;
-       }
+        {
+                return SQL_INVALID_HANDLE;
+        }
 
-       if( phdbc == NULL )
-       {
-               PUSHSQLERR ( genv->herr, en_S1009 );
+        if( phdbc == NULL )
+        {
+                PUSHSQLERR ( genv->herr, en_S1009 );
 
-               return SQL_ERROR;
-       }
+                return SQL_ERROR;
+        }
 
-       pdbc = (DBC_t FAR*)MEM_ALLOC (sizeof(DBC_t));
+        pdbc = (DBC_t FAR*)MEM_ALLOC (sizeof(DBC_t));
 
-       if( pdbc == NULL )
-       {
-               *phdbc = SQL_NULL_HDBC;
+        if( pdbc == NULL )
+        {
+                *phdbc = SQL_NULL_HDBC;
 
-               PUSHSQLERR ( genv->herr, en_S1001 );
+                PUSHSQLERR ( genv->herr, en_S1001 );
 
-               return SQL_ERROR;
-       }
+                return SQL_ERROR;
+        }
 
 #if (ODBCVER >= 0x0300)
-       pdbc->type = SQL_HANDLE_DBC;
+        pdbc->type = SQL_HANDLE_DBC;
 #endif
-       /* insert this dbc entry into the link list */
-       pdbc->next = genv->hdbc;
-       genv->hdbc = pdbc;
-       pdbc->genv = henv;              
-
-       pdbc->henv = SQL_NULL_HENV;     
-       pdbc->hstmt= SQL_NULL_HSTMT;
-       pdbc->herr = SQL_NULL_HERR;
-       pdbc->dhdbc= SQL_NULL_HDBC;     
-       pdbc->state= en_dbc_allocated;
-       pdbc->trace = 0;
-       pdbc->tstm  = NULL;
-       pdbc->tfile = NULL;
-
-       /* set connect options to default values */
-       pdbc->access_mode       = SQL_MODE_DEFAULT;
-       pdbc->autocommit        = SQL_AUTOCOMMIT_DEFAULT;
-       pdbc->current_qualifier = NULL;
-       pdbc->login_timeout     = 0UL;
-       pdbc->odbc_cursors      = SQL_CUR_DEFAULT;
-       pdbc->packet_size       = 0UL;
-       pdbc->quiet_mode        = (UDWORD)NULL;
-       pdbc->txn_isolation     = SQL_TXN_READ_UNCOMMITTED;
-       pdbc->cb_commit         = (SWORD)SQL_CB_DELETE;
-       pdbc->cb_rollback       = (SWORD)SQL_CB_DELETE;
-
-       *phdbc = (HDBC)pdbc;
-
-       return SQL_SUCCESS;
+        /* insert this dbc entry into the link list */
+        pdbc->next = genv->hdbc;
+        genv->hdbc = pdbc;
+        pdbc->genv = henv;
+
+        pdbc->henv = SQL_NULL_HENV;
+        pdbc->hstmt= SQL_NULL_HSTMT;
+        pdbc->herr = SQL_NULL_HERR;
+        pdbc->dhdbc= SQL_NULL_HDBC;
+        pdbc->state= en_dbc_allocated;
+        pdbc->trace = 0;
+        pdbc->tstm  = NULL;
+        pdbc->tfile = NULL;
+
+        /* set connect options to default values */
+        pdbc->access_mode       = SQL_MODE_DEFAULT;
+        pdbc->autocommit        = SQL_AUTOCOMMIT_DEFAULT;
+        pdbc->current_qualifier = NULL;
+        pdbc->login_timeout     = 0UL;
+        pdbc->odbc_cursors      = SQL_CUR_DEFAULT;
+        pdbc->packet_size       = 0UL;
+        pdbc->quiet_mode        = (UDWORD)NULL;
+        pdbc->txn_isolation     = SQL_TXN_READ_UNCOMMITTED;
+        pdbc->cb_commit         = (SWORD)SQL_CB_DELETE;
+        pdbc->cb_rollback       = (SWORD)SQL_CB_DELETE;
+
+        *phdbc = (HDBC)pdbc;
+
+        return SQL_SUCCESS;
 }
 
-RETCODE SQL_API        SQLFreeConnect( HDBC    hdbc )
+RETCODE SQL_API SQLFreeConnect( HDBC    hdbc )
 {
-       GENV_t FAR*     genv;
-       DBC_t  FAR*     pdbc = (DBC_t FAR*)hdbc;
-       DBC_t  FAR*     tpdbc;
-
-       if( hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       /* check state */
-       if( pdbc->state != en_dbc_allocated ) 
-       {
-               PUSHSQLERR ( pdbc->herr, en_S1010 );
-
-               return SQL_ERROR;
-       }
-
-       genv = (GENV_t FAR*)pdbc->genv;
-
-       for( tpdbc  = (DBC_t FAR*)genv->hdbc;
-            tpdbc != NULL;
-            tpdbc  = tpdbc->next )
-       {
-               if( pdbc == tpdbc )
-               {
-                       genv->hdbc = pdbc->next;
-                       break;
-               }
-
-               if( pdbc == tpdbc->next )
-               {
-                       tpdbc->next = pdbc->next;
-                       break;
-               }
-       }
-
-       /* free this dbc */
-       _iodbcdm_driverunload(pdbc);
-       _iodbcdm_freesqlerrlist( pdbc->herr );
-
-       if( pdbc->tfile )
-       {
-               MEM_FREE( pdbc->tfile );
-       }
-
-       SQLSetConnectOption( pdbc, SQL_OPT_TRACE, SQL_OPT_TRACE_OFF);
-
-       MEM_FREE ( pdbc );
-
-       return SQL_SUCCESS;
+        GENV_t FAR*     genv;
+        DBC_t  FAR*     pdbc = (DBC_t FAR*)hdbc;
+        DBC_t  FAR*     tpdbc;
+
+        if( hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        /* check state */
+        if( pdbc->state != en_dbc_allocated )
+        {
+                PUSHSQLERR ( pdbc->herr, en_S1010 );
+
+                return SQL_ERROR;
+        }
+
+        genv = (GENV_t FAR*)pdbc->genv;
+
+        for( tpdbc  = (DBC_t FAR*)genv->hdbc;
+             tpdbc != NULL;
+             tpdbc  = tpdbc->next )
+        {
+                if( pdbc == tpdbc )
+                {
+                        genv->hdbc = pdbc->next;
+                        break;
+                }
+
+                if( pdbc == tpdbc->next )
+                {
+                        tpdbc->next = pdbc->next;
+                        break;
+                }
+        }
+
+        /* free this dbc */
+        _iodbcdm_driverunload(pdbc);
+        _iodbcdm_freesqlerrlist( pdbc->herr );
+
+        if( pdbc->tfile )
+        {
+                MEM_FREE( pdbc->tfile );
+        }
+
+        SQLSetConnectOption( pdbc, SQL_OPT_TRACE, SQL_OPT_TRACE_OFF);
+
+        MEM_FREE ( pdbc );
+
+        return SQL_SUCCESS;
 }
 
-RETCODE SQL_API        SQLSetConnectOption(
-                       HDBC    hdbc,
-                       UWORD   fOption,
-                       UDWORD  vParam )
+RETCODE SQL_API SQLSetConnectOption(
+                        HDBC    hdbc,
+                        UWORD   fOption,
+                        UDWORD  vParam )
 {
-/*     GENV_t FAR*     genv;  */
-       DBC_t  FAR*     pdbc    = (DBC_t FAR*)hdbc;
-       STMT_t FAR*     pstmt;
-       HPROC           hproc   = SQL_NULL_HPROC;
-       int             sqlstat = en_00000;
-       RETCODE         retcode = SQL_SUCCESS;
-
-       if( hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       /* check option */
-       if( fOption < SQL_CONN_OPT_MIN 
-        || ( fOption > SQL_CONN_OPT_MAX 
-          && fOption < SQL_CONNECT_OPT_DRVR_START ) )
-       {
-               PUSHSQLERR ( pdbc->herr, en_S1092 );
-
-               return SQL_ERROR;
-       }
-
-       /* check state of connection handle */
-       switch( pdbc->state )
-       {
-               case en_dbc_allocated:
-                       if( fOption == SQL_TRANSLATE_DLL
-                        || fOption == SQL_TRANSLATE_OPTION )
-                       {
-                               /* This two options are only meaningful
-                                * for specified driver. So, has to be
-                                * set after a dirver has been loaded.
-                                */
-                               sqlstat = en_08003;
-                               break;
-                       }
-
-                       if( fOption >= SQL_CONNECT_OPT_DRVR_START 
-                        && pdbc->henv == SQL_NULL_HENV )
-                       /* An option only meaningful for drivers
-                        * is passed before loading a driver.
-                        * We classify this as an invalid option error.
-                        * This is not documented by MS SDK guide.
-                        */
-                       {
-                               sqlstat = en_S1092;
-                               break;
-                       }
-                       break;
-
-               case en_dbc_needdata:
-                       sqlstat = en_S1010;
-                       break;
-
-               case en_dbc_connected:
-               case en_dbc_hstmt:
-                       if( fOption == SQL_ODBC_CURSORS )
-                       {
-                               sqlstat = en_08002;
-                       }
-                       break;
-
-               default:
-                       break;
-       }
-
-       /* check state of statement handle(s) */
-       for( pstmt  = (STMT_t FAR*)pdbc->hstmt;
-            pstmt != NULL && sqlstat == en_00000;
-            pstmt  = (STMT_t FAR*)pstmt->next )
-       {
-               if( pstmt->state >= en_stmt_needdata 
-                || pstmt->asyn_on != en_NullProc )
-               {
-                       sqlstat = en_S1010;
-               }
-       }
-
-       if( sqlstat != en_00000 )
-       {
-               PUSHSQLERR ( pdbc->herr, sqlstat );
-       
-               return SQL_ERROR;
-       }
-
-       if( fOption == SQL_OPT_TRACE )
-       /* tracing flag can be set before and after connect 
-        * and only meaningful for driver manager(actually
-        * there is only one tracing file under one global
-        * environment).
-        */
-       {
-               switch( vParam )
-               {
-                       case SQL_OPT_TRACE_ON: 
-                               if( pdbc->tfile == NULL )
-                               {
-                                       pdbc->tfile = (char FAR*)MEM_ALLOC( 1 +
-                                               STRLEN(SQL_OPT_TRACE_FILE_DEFAULT) );
-
-                                       if( pdbc->tfile == NULL )
-                                       {
-                                               PUSHSQLERR( pdbc->herr, en_S1001 );
-
-                                               return SQL_ERROR;
-                                       }
-
-                                       STRCPY( pdbc->tfile, SQL_OPT_TRACE_FILE_DEFAULT );
-                               }
-
-                               if( pdbc->tstm == NULL )
-                               {
-#if    defined(stderr) && defined(stdout)
-                                       if(STREQ( pdbc->tfile, "stderr"))
-                                       {
-                                               pdbc->tstm = stderr;
-                                       }
-                                       else
-                                       if(STREQ(pdbc->tfile, "stdout"))
-                                       {
-                                               pdbc->tstm = stdout;
-                                       }
-                                       else
-#endif 
-                                       {
-                                               pdbc->tstm 
-                                                       = fopen(pdbc->tfile, "a+"); 
-                                       }
-
-                                       if(pdbc->tstm )
-                                       {
-                                               pdbc->trace = 1;
-                                       }
-                                       else
-                                       {
-                                               pdbc->trace = 0;
-
-                                               sqlstat = en_IM013;
-                                               retcode = SQL_ERROR;
-                                       }
-                               }
-                               break;
-
-                       case SQL_OPT_TRACE_OFF:
-                               if( pdbc->trace && pdbc->tstm )
-                               {
-#if    defined(stderr) && defined(stdout)
-                                       if( stderr != (FILE FAR*)(pdbc->tstm)
-                                        && stdout != (FILE FAR*)(pdbc->tstm) )
+        GENV_t FAR*     genv;
+        DBC_t  FAR*     pdbc    = (DBC_t FAR*)hdbc;
+        STMT_t FAR*     pstmt;
+        HPROC           hproc   = SQL_NULL_HPROC;
+        int             sqlstat = en_00000;
+        RETCODE         retcode = SQL_SUCCESS;
+
+        if( hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        /* check option */
+        if( fOption < SQL_CONN_OPT_MIN
+         || ( fOption > SQL_CONN_OPT_MAX
+           && fOption < SQL_CONNECT_OPT_DRVR_START ) )
+        {
+                PUSHSQLERR ( pdbc->herr, en_S1092 );
+
+                return SQL_ERROR;
+        }
+
+        /* check state of connection handle */
+        switch( pdbc->state )
+        {
+                case en_dbc_allocated:
+                        if( fOption == SQL_TRANSLATE_DLL
+                         || fOption == SQL_TRANSLATE_OPTION )
+                        {
+                                /* This two options are only meaningful
+                                 * for specified driver. So, has to be
+                                 * set after a dirver has been loaded.
+                                 */
+                                sqlstat = en_08003;
+                                break;
+                        }
+
+                        if( fOption >= SQL_CONNECT_OPT_DRVR_START
+                         && pdbc->henv == SQL_NULL_HENV )
+                        /* An option only meaningful for drivers
+                         * is passed before loading a driver.
+                         * We classify this as an invalid option error.
+                         * This is not documented by MS SDK guide.
+                         */
+                        {
+                                sqlstat = en_S1092;
+                                break;
+                        }
+                        break;
+
+                case en_dbc_needdata:
+                        sqlstat = en_S1010;
+                        break;
+
+                case en_dbc_connected:
+                case en_dbc_hstmt:
+                        if( fOption == SQL_ODBC_CURSORS )
+                        {
+                                sqlstat = en_08002;
+                        }
+                        break;
+
+                default:
+                        break;
+        }
+
+        /* check state of statement handle(s) */
+        for( pstmt  = (STMT_t FAR*)pdbc->hstmt;
+             pstmt != NULL && sqlstat == en_00000;
+             pstmt  = (STMT_t FAR*)pstmt->next )
+        {
+                if( pstmt->state >= en_stmt_needdata
+                 || pstmt->asyn_on != en_NullProc )
+                {
+                        sqlstat = en_S1010;
+                }
+        }
+
+        if( sqlstat != en_00000 )
+        {
+                PUSHSQLERR ( pdbc->herr, sqlstat );
+
+                return SQL_ERROR;
+        }
+
+        if( fOption == SQL_OPT_TRACE )
+        /* tracing flag can be set before and after connect
+         * and only meaningful for driver manager(actually
+         * there is only one tracing file under one global
+         * environment).
+         */
+        {
+                switch( vParam )
+                {
+                        case SQL_OPT_TRACE_ON:
+                                if( pdbc->tfile == NULL )
+                                {
+                                        pdbc->tfile = (char FAR*)MEM_ALLOC( 1 +
+                                                STRLEN(SQL_OPT_TRACE_FILE_DEFAULT) );
+
+                                        if( pdbc->tfile == NULL )
+                                        {
+                                                PUSHSQLERR( pdbc->herr, en_S1001 );
+
+                                                return SQL_ERROR;
+                                        }
+
+                                        STRCPY( pdbc->tfile, SQL_OPT_TRACE_FILE_DEFAULT );
+                                }
+
+                                if( pdbc->tstm == NULL )
+                                {
+#if     defined(stderr) && defined(stdout)
+                                        if(STREQ( pdbc->tfile, "stderr"))
+                                        {
+                                                pdbc->tstm = stderr;
+                                        }
+                                        else
+                                        if(STREQ(pdbc->tfile, "stdout"))
+                                        {
+                                                pdbc->tstm = stdout;
+                                        }
+                                        else
 #endif
-                                       {
-                                               fclose(pdbc->tstm);
-                                       }
-                               }
-                               pdbc->tstm = NULL;
-                               pdbc->trace = 0;  
-                               break;
-
-                       default:
-                               PUSHSQLERR (pdbc->herr, en_S1009);
-                               retcode = SQL_ERROR;
-               }
-
-               if( sqlstat != en_00000 )
-               {
-                       PUSHSQLERR ( pdbc->herr, sqlstat );
-               }
-
-               return retcode;
-       }
-
-       if( fOption == SQL_OPT_TRACEFILE )
-       /* Tracing file can be set before and after connect 
-        * and only meaningful for driver manager. 
-        */
-       {
-               if( vParam == 0UL 
-                || ((char FAR*)vParam)[0] == 0 )
-               {
-                       PUSHSQLERR ( pdbc->herr, en_S1009 );
-
-                       return SQL_ERROR;
-               }
-
-               if( pdbc->tfile && STREQ (pdbc->tfile, vParam) )
-               {
-                       return SQL_SUCCESS;
-               }
-
-               if( pdbc->trace )
-               {
-                       PUSHSQLERR ( pdbc->herr, en_IM014 );
-
-                       return SQL_ERROR;
-               }
-
-               if( pdbc->tfile )
-               {
-                       MEM_FREE( pdbc->tfile );
-               }
-
-               pdbc->tfile = (char FAR*)MEM_ALLOC( 1 + STRLEN( vParam ) );
-
-               if( pdbc->tfile == NULL )
-               {
-                       PUSHSQLERR( pdbc->herr, en_S1001 );
-
-                       return SQL_ERROR;
-               }
-
-               STRCPY ( pdbc->tfile, vParam );
-
-               return SQL_SUCCESS;
-       }
-
-       if( pdbc->state != en_dbc_allocated )
-       {
-               /* If already connected, then, driver's odbc call
-                * will be invoked. Otherwise, we only save the options
-                * and delay the setting process until the connection 
-                * been established.  
-                */
-               hproc = _iodbcdm_getproc( hdbc, en_SetConnectOption );
-
-               if( hproc == SQL_NULL_HPROC )
-               {
-                       PUSHSQLERR ( pdbc->herr, en_IM001 );
-               
-                       return SQL_ERROR;
-               }
-
-               CALL_DRIVER ( hdbc, retcode, hproc, en_SetConnectOption, (
-                               pdbc->dhdbc, fOption, vParam ) )
+                                        {
+                                                pdbc->tstm
+                                                        = fopen(pdbc->tfile, "a+");
+                                        }
+
+                                        if(pdbc->tstm )
+                                        {
+                                                pdbc->trace = 1;
+                                        }
+                                        else
+                                        {
+                                                pdbc->trace = 0;
+
+                                                sqlstat = en_IM013;
+                                                retcode = SQL_ERROR;
+                                        }
+                                }
+                                break;
+
+                        case SQL_OPT_TRACE_OFF:
+                                if( pdbc->trace && pdbc->tstm )
+                                {
+#if     defined(stderr) && defined(stdout)
+                                        if( stderr != (FILE FAR*)(pdbc->tstm)
+                                         && stdout != (FILE FAR*)(pdbc->tstm) )
+#endif
+                                        {
+                                                fclose(pdbc->tstm);
+                                        }
+                                }
+                                pdbc->tstm = NULL;
+                                pdbc->trace = 0;
+                                break;
+
+                        default:
+                                PUSHSQLERR (pdbc->herr, en_S1009);
+                                retcode = SQL_ERROR;
+                }
+
+                if( sqlstat != en_00000 )
+                {
+                        PUSHSQLERR ( pdbc->herr, sqlstat );
+                }
+
+                return retcode;
+        }
+
+        if( fOption == SQL_OPT_TRACEFILE )
+        /* Tracing file can be set before and after connect
+         * and only meaningful for driver manager.
+         */
+        {
+                if( vParam == 0UL
+                 || ((char FAR*)vParam)[0] == 0 )
+                {
+                        PUSHSQLERR ( pdbc->herr, en_S1009 );
+
+                        return SQL_ERROR;
+                }
+
+                if( pdbc->tfile && STREQ (pdbc->tfile, vParam) )
+                {
+                        return SQL_SUCCESS;
+                }
+
+                if( pdbc->trace )
+                {
+                        PUSHSQLERR ( pdbc->herr, en_IM014 );
+
+                        return SQL_ERROR;
+                }
+
+                if( pdbc->tfile )
+                {
+                        MEM_FREE( pdbc->tfile );
+                }
+
+                pdbc->tfile = (char FAR*)MEM_ALLOC( 1 + STRLEN( vParam ) );
+
+                if( pdbc->tfile == NULL )
+                {
+                        PUSHSQLERR( pdbc->herr, en_S1001 );
+
+                        return SQL_ERROR;
+                }
+
+                STRCPY ( pdbc->tfile, vParam );
+
+                return SQL_SUCCESS;
+        }
+
+        if( pdbc->state != en_dbc_allocated )
+        {
+                /* If already connected, then, driver's odbc call
+                 * will be invoked. Otherwise, we only save the options
+                 * and delay the setting process until the connection
+                 * been established.
+                 */
+                hproc = _iodbcdm_getproc( hdbc, en_SetConnectOption );
+
+                if( hproc == SQL_NULL_HPROC )
+                {
+                        PUSHSQLERR ( pdbc->herr, en_IM001 );
+
+                        return SQL_ERROR;
+                }
+
+                CALL_DRIVER ( hdbc, retcode, hproc, en_SetConnectOption, (
+                                pdbc->dhdbc, fOption, vParam ) )
 
 #if 0
-               retcode = hproc( pdbc->dhdbc, fOption, vParam);
+                retcode = hproc( pdbc->dhdbc, fOption, vParam);
 #endif
 
-               if( retcode != SQL_SUCCESS
-                && retcode != SQL_SUCCESS_WITH_INFO )
-               {
-                       return retcode;
-               }
-       }
-
-       /* 
-        * Now, either driver's odbc call was successed or
-        * driver has not been loaded yet. In the first case, we
-        * need flip flag for(such as access_mode, autocommit, ...)
-        * for our finit state machine. While in the second case, 
-        * we need save option values(such as current_qualifier, ...)
-        * for delaied setting. So, ...
-        */
-
-       /* No matter what state we are(i.e. allocated or connected, ..)
-        * we need to flip the flag.
-        */
-       switch( fOption )
-       {
-               case SQL_ACCESS_MODE:
-                       pdbc->access_mode = vParam;
-                       break;
-
-               case SQL_AUTOCOMMIT:
-                       pdbc->autocommit  = vParam;
-                       break;
-       }
-
-       /* state transition */
-       if( pdbc->state != en_dbc_allocated )
-       {
-               return retcode;
-       }
-
-       /* Only 'allocated' state is possible here, and we need to
-        * save the options for delaied setting.
-        */
-       switch( fOption )
-       {
-               case SQL_CURRENT_QUALIFIER:
-                       if( pdbc->current_qualifier != NULL )
-                       {
-                               MEM_FREE ( pdbc->current_qualifier );
-                       }
-
-                       if( vParam == 0UL )
-                       {
-                               pdbc->current_qualifier = NULL;
-
-                               break;
-                       }
-
-                       pdbc->current_qualifier 
-                               = (char FAR*)MEM_ALLOC ( 
-                               STRLEN (vParam) + 1 );
-
-                       if( pdbc->current_qualifier == NULL )
-                       {
-                               PUSHSQLERR ( pdbc->herr, en_S1001 );
-                               return SQL_ERROR;
-                       }
-
-                       STRCPY ( pdbc->current_qualifier, vParam );
-                       break;
-
-               case SQL_LOGIN_TIMEOUT:
-                       pdbc->login_timeout = vParam;
-                       break;
-
-               case SQL_ODBC_CURSORS:
-                       pdbc->odbc_cursors = vParam;
-                       break;
-
-               case SQL_PACKET_SIZE:
-                       pdbc->packet_size = vParam;
-                       break;
-
-               case SQL_QUIET_MODE:
-                       pdbc->quiet_mode = vParam;
-                       break;
-
-               case SQL_TXN_ISOLATION:
-                       pdbc->txn_isolation = vParam;
-                       break;
-
-               default:
-                       /* Since we didn't save the option value for delaied
-                        * setting, we should raise an error here.
-                        */
-                       break;
-       }
-
-       return retcode;
+                if( retcode != SQL_SUCCESS
+                 && retcode != SQL_SUCCESS_WITH_INFO )
+                {
+                        return retcode;
+                }
+        }
+
+        /*
+         * Now, either driver's odbc call was successed or
+         * driver has not been loaded yet. In the first case, we
+         * need flip flag for(such as access_mode, autocommit, ...)
+         * for our finit state machine. While in the second case,
+         * we need save option values(such as current_qualifier, ...)
+         * for delaied setting. So, ...
+         */
+
+        /* No matter what state we are(i.e. allocated or connected, ..)
+         * we need to flip the flag.
+         */
+        switch( fOption )
+        {
+                case SQL_ACCESS_MODE:
+                        pdbc->access_mode = vParam;
+                        break;
+
+                case SQL_AUTOCOMMIT:
+                        pdbc->autocommit  = vParam;
+                        break;
+        }
+
+        /* state transition */
+        if( pdbc->state != en_dbc_allocated )
+        {
+                return retcode;
+        }
+
+        /* Only 'allocated' state is possible here, and we need to
+         * save the options for delaied setting.
+         */
+        switch( fOption )
+        {
+                case SQL_CURRENT_QUALIFIER:
+                        if( pdbc->current_qualifier != NULL )
+                        {
+                                MEM_FREE ( pdbc->current_qualifier );
+                        }
+
+                        if( vParam == 0UL )
+                        {
+                                pdbc->current_qualifier = NULL;
+
+                                break;
+                        }
+
+                        pdbc->current_qualifier
+                                = (char FAR*)MEM_ALLOC (
+                                STRLEN (vParam) + 1 );
+
+                        if( pdbc->current_qualifier == NULL )
+                        {
+                                PUSHSQLERR ( pdbc->herr, en_S1001 );
+                                return SQL_ERROR;
+                        }
+
+                        STRCPY ( pdbc->current_qualifier, vParam );
+                        break;
+
+                case SQL_LOGIN_TIMEOUT:
+                        pdbc->login_timeout = vParam;
+                        break;
+
+                case SQL_ODBC_CURSORS:
+                        pdbc->odbc_cursors = vParam;
+                        break;
+
+                case SQL_PACKET_SIZE:
+                        pdbc->packet_size = vParam;
+                        break;
+
+                case SQL_QUIET_MODE:
+                        pdbc->quiet_mode = vParam;
+                        break;
+
+                case SQL_TXN_ISOLATION:
+                        pdbc->txn_isolation = vParam;
+                        break;
+
+                default:
+                        /* Since we didn't save the option value for delaied
+                         * setting, we should raise an error here.
+                         */
+                        break;
+        }
+
+        return retcode;
 }
 
-RETCODE SQL_API        SQLGetConnectOption(
-                       HDBC    hdbc,
-                       UWORD   fOption,
-                       PTR     pvParam )
+RETCODE SQL_API SQLGetConnectOption(
+                        HDBC    hdbc,
+                        UWORD   fOption,
+                        PTR     pvParam )
 {
-/*     GENV_t FAR*     genv; */
-       DBC_t  FAR*     pdbc = (DBC_t FAR*)hdbc;
-       int             sqlstat = en_00000;
-       HPROC           hproc   = SQL_NULL_HPROC;
-       RETCODE         retcode;
-
-       if( hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       /* check option */
-       if( fOption < SQL_CONN_OPT_MIN 
-        || ( fOption > SQL_CONN_OPT_MAX 
-          && fOption < SQL_CONNECT_OPT_DRVR_START ) )
-       {
-               PUSHSQLERR ( pdbc->herr, en_S1092 );
-
-               return SQL_ERROR;
-       }
-
-       /* check state */
-       switch( pdbc->state )
-       {
-               case en_dbc_allocated:
-                       if( fOption != SQL_ACCESS_MODE
-                        && fOption != SQL_AUTOCOMMIT 
-                        && fOption != SQL_LOGIN_TIMEOUT
-                        && fOption != SQL_OPT_TRACE
-                        && fOption != SQL_OPT_TRACEFILE )
-                       {
-                               sqlstat = en_08003;
-                       }
-                       /* MS ODBC SDK document only
-                        * allows SQL_ACCESS_MODE
-                        * and SQL_AUTOCOMMIT in this
-                        * dbc state. We allow another 
-                        * two options, because they 
-                        * are only meaningful for driver 
-                        * manager.  
-                        */
-                       break;
-
-               case en_dbc_needdata:
-                       sqlstat = en_S1010;
-                       break;
-
-               default:
-                       break;
-       }
-
-       if( sqlstat != en_00000 )
-       {
-               PUSHSQLERR ( pdbc->herr, sqlstat );
-
-               return SQL_ERROR;
-       }
-
-       /* Tracing and tracing file options are only 
-        * meaningful for driver manager
-        */
-       if( fOption == SQL_OPT_TRACE )
-       {
-               if( pdbc->trace )
-                       *((UDWORD*)pvParam) = (UDWORD)SQL_OPT_TRACE_ON;
-               else    
-                       *((UDWORD*)pvParam) = (UDWORD)SQL_OPT_TRACE_OFF;
-
-               return SQL_SUCCESS;
-       }
-
-       if( fOption == SQL_OPT_TRACEFILE )
-       {
-               STRCPY (pvParam, pdbc->tfile );
-
-               return SQL_ERROR;
-       }
-
-       if( pdbc->state !=  en_dbc_allocated )
-       /* if already connected, we will invoke driver's function */
-       {
-               hproc = _iodbcdm_getproc( hdbc, en_GetConnectOption );
-
-               if( hproc == SQL_NULL_HPROC )
-               {
-                       PUSHSQLERR( pdbc->herr, en_IM001 );
-               
-                       return SQL_ERROR;
-               }
-
-               CALL_DRIVER ( hdbc, retcode, hproc, en_GetConnectOption, (
-                       pdbc->dhdbc, fOption, pvParam ) )
+        GENV_t FAR*     genv;
+        DBC_t  FAR*     pdbc = (DBC_t FAR*)hdbc;
+        int             sqlstat = en_00000;
+        HPROC           hproc   = SQL_NULL_HPROC;
+        RETCODE         retcode;
+
+        if( hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        /* check option */
+        if( fOption < SQL_CONN_OPT_MIN
+         || ( fOption > SQL_CONN_OPT_MAX
+           && fOption < SQL_CONNECT_OPT_DRVR_START ) )
+        {
+                PUSHSQLERR ( pdbc->herr, en_S1092 );
+
+                return SQL_ERROR;
+        }
+
+        /* check state */
+        switch( pdbc->state )
+        {
+                case en_dbc_allocated:
+                        if( fOption != SQL_ACCESS_MODE
+                         && fOption != SQL_AUTOCOMMIT
+                         && fOption != SQL_LOGIN_TIMEOUT
+                         && fOption != SQL_OPT_TRACE
+                         && fOption != SQL_OPT_TRACEFILE )
+                        {
+                                sqlstat = en_08003;
+                        }
+                        /* MS ODBC SDK document only
+                         * allows SQL_ACCESS_MODE
+                         * and SQL_AUTOCOMMIT in this
+                         * dbc state. We allow another
+                         * two options, because they
+                         * are only meaningful for driver
+                         * manager.
+                         */
+                        break;
+
+                case en_dbc_needdata:
+                        sqlstat = en_S1010;
+                        break;
+
+                default:
+                        break;
+        }
+
+        if( sqlstat != en_00000 )
+        {
+                PUSHSQLERR ( pdbc->herr, sqlstat );
+
+                return SQL_ERROR;
+        }
+
+        /* Tracing and tracing file options are only
+         * meaningful for driver manager
+         */
+        if( fOption == SQL_OPT_TRACE )
+        {
+                if( pdbc->trace )
+                        *((UDWORD*)pvParam) = (UDWORD)SQL_OPT_TRACE_ON;
+                else
+                        *((UDWORD*)pvParam) = (UDWORD)SQL_OPT_TRACE_OFF;
+
+                return SQL_SUCCESS;
+        }
+
+        if( fOption == SQL_OPT_TRACEFILE )
+        {
+                STRCPY (pvParam, pdbc->tfile );
+
+                return SQL_ERROR;
+        }
+
+        if( pdbc->state !=  en_dbc_allocated )
+        /* if already connected, we will invoke driver's function */
+        {
+                hproc = _iodbcdm_getproc( hdbc, en_GetConnectOption );
+
+                if( hproc == SQL_NULL_HPROC )
+                {
+                        PUSHSQLERR( pdbc->herr, en_IM001 );
+
+                        return SQL_ERROR;
+                }
+
+                CALL_DRIVER ( hdbc, retcode, hproc, en_GetConnectOption, (
+                        pdbc->dhdbc, fOption, pvParam ) )
 
 #if 0
-               retcode = hproc(pdbc->dhdbc, fOption, pvParam);
+                retcode = hproc(pdbc->dhdbc, fOption, pvParam);
 #endif
-               
-               return retcode;
-       }
-
-       /* We needn't to handle options which are not allowed 
-        * to be *get* at a allocated dbc state(and two tracing
-        * options which has been handled and returned). Thus, 
-        * there are only two possible cases. 
-        */
-       switch( fOption )
-       {
-               case SQL_ACCESS_MODE:
-                       *((UDWORD*)pvParam) = pdbc->access_mode;
-                       break;
-
-               case SQL_AUTOCOMMIT:
-                       *((UDWORD*)pvParam) = pdbc->autocommit;
-                       break;
-
-               case SQL_LOGIN_TIMEOUT:
-                       *((UDWORD*)pvParam) = pdbc->login_timeout;
-                       break;
-
-               default:
-                       break;
-       }
-
-       return SQL_SUCCESS;
+
+                return retcode;
+        }
+
+        /* We needn't to handle options which are not allowed
+         * to be *get* at a allocated dbc state(and two tracing
+         * options which has been handled and returned). Thus,
+         * there are only two possible cases.
+         */
+        switch( fOption )
+        {
+                case SQL_ACCESS_MODE:
+                        *((UDWORD*)pvParam) = pdbc->access_mode;
+                        break;
+
+                case SQL_AUTOCOMMIT:
+                        *((UDWORD*)pvParam) = pdbc->autocommit;
+                        break;
+
+                case SQL_LOGIN_TIMEOUT:
+                        *((UDWORD*)pvParam) = pdbc->login_timeout;
+                        break;
+
+                default:
+                        break;
+        }
+
+        return SQL_SUCCESS;
 }
 
-static RETCODE _iodbcdm_transact( 
-                       HDBC    hdbc,
-                       UWORD   fType )
+static RETCODE  _iodbcdm_transact(
+                        HDBC    hdbc,
+                        UWORD   fType )
 {
-       DBC_t  FAR*     pdbc = (DBC_t FAR*)hdbc;
-       STMT_t FAR*     pstmt;
-       HPROC           hproc;
-       RETCODE         retcode;
-
-       /* check state */
-       switch( pdbc->state )
-       {
-               case en_dbc_allocated:
-               case en_dbc_needdata:
-                       PUSHSQLERR ( pdbc->herr, en_08003 );
-                       return SQL_ERROR;
-
-               case en_dbc_connected:
-                       return SQL_SUCCESS;
-
-               case en_dbc_hstmt:
-               default:
-                       break;
-       }
-
-       for( pstmt  = (STMT_t FAR*)(pdbc->hstmt);
-            pstmt != NULL;
-            pstmt  = pstmt->next )
-       {
-               if( pstmt->state >= en_stmt_needdata
-                || pstmt->asyn_on != en_NullProc )
-               {
-                       PUSHSQLERR ( pdbc->herr, en_S1010 );
-
-                       return SQL_ERROR;
-               }
-       }
-
-       hproc = _iodbcdm_getproc( hdbc, en_Transact );
-
-       if( hproc == SQL_NULL_HPROC )
-       {
-               PUSHSQLERR ( pdbc->herr, en_IM001 );
-
-               return SQL_ERROR;
-       }
-
-       CALL_DRIVER ( hdbc, retcode, hproc, en_Transact, (
-                       SQL_NULL_HENV, pdbc->dhdbc, fType ) )
+        DBC_t  FAR*     pdbc = (DBC_t FAR*)hdbc;
+        STMT_t FAR*     pstmt;
+        HPROC           hproc;
+        RETCODE         retcode;
+
+        /* check state */
+        switch( pdbc->state )
+        {
+                case en_dbc_allocated:
+                case en_dbc_needdata:
+                        PUSHSQLERR ( pdbc->herr, en_08003 );
+                        return SQL_ERROR;
+
+                case en_dbc_connected:
+                        return SQL_SUCCESS;
+
+                case en_dbc_hstmt:
+                default:
+                        break;
+        }
+
+        for( pstmt  = (STMT_t FAR*)(pdbc->hstmt);
+             pstmt != NULL;
+             pstmt  = pstmt->next )
+        {
+                if( pstmt->state >= en_stmt_needdata
+                 || pstmt->asyn_on != en_NullProc )
+                {
+                        PUSHSQLERR ( pdbc->herr, en_S1010 );
+
+                        return SQL_ERROR;
+                }
+        }
+
+        hproc = _iodbcdm_getproc( hdbc, en_Transact );
+
+        if( hproc == SQL_NULL_HPROC )
+        {
+                PUSHSQLERR ( pdbc->herr, en_IM001 );
+
+                return SQL_ERROR;
+        }
+
+        CALL_DRIVER ( hdbc, retcode, hproc, en_Transact, (
+                        SQL_NULL_HENV, pdbc->dhdbc, fType ) )
 
 #if 0
-       retcode = hproc( SQL_NULL_HENV, pdbc->dhdbc, fType );
+        retcode = hproc( SQL_NULL_HENV, pdbc->dhdbc, fType );
 #endif
 
-       /* state transition */
-       if( retcode != SQL_SUCCESS
-        && retcode != SQL_SUCCESS_WITH_INFO )
-       {
-               return retcode;
-       }
-
-       pdbc->state = en_dbc_hstmt;
-
-       for( pstmt  = (STMT_t FAR*)(pdbc->hstmt);
-            pstmt != NULL;
-            pstmt  = pstmt->next )
-       {
-               switch( pstmt->state )
-               {
-                       case en_stmt_prepared:
-                               if( pdbc->cb_commit   == SQL_CB_DELETE
-                                || pdbc->cb_rollback == SQL_CB_DELETE )
-                               {
-                                       pstmt->state = en_stmt_allocated;
-                                       pstmt->prep_state = 0;
-                                       break;
-                               }
-                               break;
-
-                       case en_stmt_executed:
-                       case en_stmt_cursoropen:
-                       case en_stmt_fetched:
-                       case en_stmt_xfetched:
-                               if( ! pstmt->prep_state
-                                && pdbc->cb_commit   != SQL_CB_PRESERVE
-                                && pdbc->cb_rollback != SQL_CB_PRESERVE )
-                               {
-                                       pstmt->state = en_stmt_allocated;
-                                       pstmt->prep_state = 0;
-                                       pstmt->cursor_state = en_stmt_cursor_no;
-                                       break;
-                               }
-
-                               if( pstmt->prep_state )
-                               {
-                                       if( pdbc->cb_commit  == SQL_CB_DELETE
-                                        || pdbc->cb_rollback== SQL_CB_DELETE )
-                                       {
-                                               pstmt->state = en_stmt_allocated;
-                                               pstmt->prep_state = 0;
-                                               pstmt->cursor_state = en_stmt_cursor_no;
-                                               break;
-                                       }
-
-                                       if( pdbc->cb_commit  == SQL_CB_CLOSE
-                                        || pdbc->cb_rollback== SQL_CB_CLOSE )
-                                       {
-                                               pstmt->state 
-                                                       = en_stmt_prepared;
-                                               pstmt->cursor_state 
-                                               = en_stmt_cursor_no;
-                                               break;
-                                       }
-                                       break;
-                               }
-                               break;
-
-                       default:
-                               break;
-               } 
-       }
-
-       return retcode;
+        /* state transition */
+        if( retcode != SQL_SUCCESS
+         && retcode != SQL_SUCCESS_WITH_INFO )
+        {
+                return retcode;
+        }
+
+        pdbc->state = en_dbc_hstmt;
+
+        for( pstmt  = (STMT_t FAR*)(pdbc->hstmt);
+             pstmt != NULL;
+             pstmt  = pstmt->next )
+        {
+                switch( pstmt->state )
+                {
+                        case en_stmt_prepared:
+                                if( pdbc->cb_commit   == SQL_CB_DELETE
+                                 || pdbc->cb_rollback == SQL_CB_DELETE )
+                                {
+                                        pstmt->state = en_stmt_allocated;
+                                        pstmt->prep_state = 0;
+                                        break;
+                                }
+                                break;
+
+                        case en_stmt_executed:
+                        case en_stmt_cursoropen:
+                        case en_stmt_fetched:
+                        case en_stmt_xfetched:
+                                if( ! pstmt->prep_state
+                                 && pdbc->cb_commit   != SQL_CB_PRESERVE
+                                 && pdbc->cb_rollback != SQL_CB_PRESERVE )
+                                {
+                                        pstmt->state = en_stmt_allocated;
+                                        pstmt->prep_state = 0;
+                                        pstmt->cursor_state = en_stmt_cursor_no;
+                                        break;
+                                }
+
+                                if( pstmt->prep_state )
+                                {
+                                        if( pdbc->cb_commit  == SQL_CB_DELETE
+                                         || pdbc->cb_rollback== SQL_CB_DELETE )
+                                        {
+                                                pstmt->state = en_stmt_allocated;
+                                                pstmt->prep_state = 0;
+                                                pstmt->cursor_state = en_stmt_cursor_no;
+                                                break;
+                                        }
+
+                                        if( pdbc->cb_commit  == SQL_CB_CLOSE
+                                         || pdbc->cb_rollback== SQL_CB_CLOSE )
+                                        {
+                                                pstmt->state
+                                                        = en_stmt_prepared;
+                                                pstmt->cursor_state
+                                                = en_stmt_cursor_no;
+                                                break;
+                                        }
+                                        break;
+                                }
+                                break;
+
+                        default:
+                                break;
+                }
+        }
+
+        return retcode;
 }
 
-RETCODE        SQL_API SQLTransact(
-               HENV    henv,
-               HDBC    hdbc,
-               UWORD   fType )
+RETCODE SQL_API SQLTransact(
+                HENV    henv,
+                HDBC    hdbc,
+                UWORD   fType )
 {
-       GENV_t FAR*     genv    = (GENV_t FAR*)henv;
-       DBC_t  FAR*     pdbc    = (DBC_t FAR*)hdbc;
-       HERR            herr;
-       RETCODE         retcode = 0;
-
-       if( hdbc != SQL_NULL_HDBC )
-       {
-               herr = pdbc->herr;
-       }
-       else if( henv != SQL_NULL_HENV )
-       {
-               herr = genv->herr;
-       }
-       else
-       {
-               return SQL_INVALID_HANDLE;
-       }
-       
-       /* check argument */
-       if( fType != SQL_COMMIT
-        && fType != SQL_ROLLBACK )
-       {
-               PUSHSQLERR ( herr, en_S1012 );
-
-               return SQL_ERROR;
-       }
-
-       if( hdbc != SQL_NULL_HDBC )
-       {
-               retcode = _iodbcdm_transact( hdbc, fType );
-       }
-       else
-       {
-               for( pdbc  = (DBC_t FAR*)(genv->hdbc);
-                    pdbc != NULL;
-                    pdbc  = pdbc->next )
-               {
-                       retcode |= _iodbcdm_transact( hdbc, fType );
-               }
-       }
-
-       if( retcode != SQL_SUCCESS
-        && retcode != SQL_SUCCESS_WITH_INFO )
-       {
-               /* fail on one of the connection */
-               return SQL_ERROR;
-       }
-
-       return retcode;
+        GENV_t FAR*     genv    = (GENV_t FAR*)henv;
+        DBC_t  FAR*     pdbc    = (DBC_t FAR*)hdbc;
+        HERR            herr;
+        RETCODE         retcode;
+
+        if( hdbc != SQL_NULL_HDBC )
+        {
+                herr = pdbc->herr;
+        }
+        else if( henv != SQL_NULL_HENV )
+        {
+                herr = genv->herr;
+        }
+        else
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        /* check argument */
+        if( fType != SQL_COMMIT
+         && fType != SQL_ROLLBACK )
+        {
+                PUSHSQLERR ( herr, en_S1012 );
+
+                return SQL_ERROR;
+        }
+
+        if( hdbc != SQL_NULL_HDBC )
+        {
+                retcode = _iodbcdm_transact( hdbc, fType );
+        }
+        else
+        {
+                for( pdbc  = (DBC_t FAR*)(genv->hdbc);
+                     pdbc != NULL;
+                     pdbc  = pdbc->next )
+                {
+                        retcode |= _iodbcdm_transact( hdbc, fType );
+                }
+        }
+
+        if( retcode != SQL_SUCCESS
+         && retcode != SQL_SUCCESS_WITH_INFO )
+        {
+                /* fail on one of the connection */
+                return SQL_ERROR;
+        }
+
+        return retcode;
 }
index 88f953983bf9b6cf915ffc4c59ec87b0f8e34951..ef62292432722d9b6430785f5b140a7d24d6d710 100644 (file)
@@ -1,55 +1,55 @@
-#ifndef        _HDBC_H
-#define        _HDBC_H
+#ifndef _HDBC_H
+#define _HDBC_H
 
-typedef        struct DBC
+typedef struct DBC
 {
-       int     type;           /* must be 1st field */
-       struct DBC FAR* 
-               next;
+        int     type;           /* must be 1st field */
+        struct DBC FAR*
+                next;
 
-       HENV    genv;           /* back point to global env object */
+        HENV    genv;           /* back point to global env object */
 
-       HDBC    dhdbc;          /* driver's private dbc */
-       HENV    henv;           /* back point to instant env object */
-       HSTMT   hstmt;          /* list of statement object handle(s) */
-       HERR    herr;
+        HDBC    dhdbc;          /* driver's private dbc */
+        HENV    henv;           /* back point to instant env object */
+        HSTMT   hstmt;          /* list of statement object handle(s) */
+        HERR    herr;
 
-       int     state;
+        int     state;
 
-       /* options */
-       UDWORD  access_mode;
-       UDWORD  autocommit;
+        /* options */
+        UDWORD  access_mode;
+        UDWORD  autocommit;
 
-       UDWORD  login_timeout;
-       UDWORD  odbc_cursors;
-       UDWORD  packet_size;
-       UDWORD  quiet_mode;
-       UDWORD  txn_isolation;
-       SWORD   cb_commit;
-       SWORD   cb_rollback;
+        UDWORD  login_timeout;
+        UDWORD  odbc_cursors;
+        UDWORD  packet_size;
+        UDWORD  quiet_mode;
+        UDWORD  txn_isolation;
+        SWORD   cb_commit;
+        SWORD   cb_rollback;
 
-       char FAR*       
-               current_qualifier;
+        char FAR*
+                current_qualifier;
 
-       int     trace;  /* trace flag */
-       char FAR*       
-               tfile;
-       void FAR*
-               tstm;   /* trace stream */
+        int     trace;  /* trace flag */
+        char FAR*
+                tfile;
+        void FAR*
+                tstm;   /* trace stream */
 } DBC_t;
 
-/* 
+/*
  * Note:
- *  - ODBC applications can see address of driver manager's 
- *    connection object, i.e connection handle -- a void pointer, 
- *    but not detail of it. ODBC applications can neither see 
+ *  - ODBC applications can see address of driver manager's
+ *    connection object, i.e connection handle -- a void pointer,
+ *    but not detail of it. ODBC applications can neither see
  *    detail driver's connection object nor its address.
  *
  *  - ODBC driver manager knows its own connection objects and
  *    exposes their address to an ODBC application. Driver manager
  *    also knows address of driver's connection objects and keeps
  *    it via dhdbc field in driver manager's connection object.
- * 
+ *
  *  - ODBC driver exposes address of its own connection object to
  *    driver manager without detail.
  *
@@ -57,11 +57,11 @@ typedef     struct DBC
  *    SQLGetInfo() with fInfoType equals to SQL_DRIVER_HDBC.
  */
 
-enum   {
-       en_dbc_allocated,
-       en_dbc_needdata,
-       en_dbc_connected,
-       en_dbc_hstmt
+enum    {
+        en_dbc_allocated,
+        en_dbc_needdata,
+        en_dbc_connected,
+        en_dbc_hstmt
 };
 
 #endif
index be4b4ae8d59f41950e5b6b1267239b9eda81c111..2ee89b2feb58c2ffcf873ff36a8bf74ed598245d 100644 (file)
@@ -1,6 +1,6 @@
 /** Environment object managment functions
-    Copyright (C) 1995 by Ke Jin <kejin@empress.com> 
+
+    Copyright (C) 1995 by Ke Jin <kejin@empress.com>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 
 #include       <../iodbc/itrace.h>
 
-RETCODE SQL_API        SQLAllocEnv( HENV FAR* phenv )
+RETCODE SQL_API SQLAllocEnv( HENV FAR* phenv )
 {
-       GENV_t FAR*     genv;
+        GENV_t FAR*     genv;
 
-       genv = (GENV_t*)MEM_ALLOC( sizeof(GENV_t) );
+        genv = (GENV_t*)MEM_ALLOC( sizeof(GENV_t) );
 
-       if( genv == NULL )
-       {
-               *phenv = SQL_NULL_HENV;
+        if( genv == NULL )
+        {
+                *phenv = SQL_NULL_HENV;
 
-               return SQL_ERROR;
-       }
+                return SQL_ERROR;
+        }
 
 #if (ODBCVER >= 0x0300 )
-       genv->type = SQL_HANDLE_ENV;
+        genv->type = SQL_HANDLE_ENV;
 #endif
 
-       genv->henv = SQL_NULL_HENV;     /* driver's env list */
-       genv->hdbc = SQL_NULL_HDBC;     /* driver's dbc list */
-       genv->herr = SQL_NULL_HERR;     /* err list          */
+        genv->henv = SQL_NULL_HENV;     /* driver's env list */
+        genv->hdbc = SQL_NULL_HDBC;     /* driver's dbc list */
+        genv->herr = SQL_NULL_HERR;     /* err list          */
 
-       *phenv = (HENV)genv;
+        *phenv = (HENV)genv;
 
-       return SQL_SUCCESS;
+        return SQL_SUCCESS;
 }
 
-RETCODE SQL_API        SQLFreeEnv ( HENV henv )
+RETCODE SQL_API SQLFreeEnv ( HENV henv )
 {
-       GENV_t FAR*     genv = (GENV_t*)henv;
+        GENV_t FAR*     genv = (GENV_t*)henv;
 
-       if( henv == SQL_NULL_HENV ) 
-       {
-               return SQL_INVALID_HANDLE;
-       }
+        if( henv == SQL_NULL_HENV )
+        {
+                return SQL_INVALID_HANDLE;
+        }
 
-       if( genv->hdbc != SQL_NULL_HDBC )
-       {
-               PUSHSQLERR ( genv->herr, en_S1010 );
+        if( genv->hdbc != SQL_NULL_HDBC )
+        {
+                PUSHSQLERR ( genv->herr, en_S1010 );
 
-               return SQL_ERROR;
-       }
+                return SQL_ERROR;
+        }
 
-       _iodbcdm_freesqlerrlist( genv->herr );
+        _iodbcdm_freesqlerrlist( genv->herr );
 
-       MEM_FREE( henv );
+        MEM_FREE( henv );
 
-       return SQL_SUCCESS;
+        return SQL_SUCCESS;
 }
index 639c6ec84272c1584e7c4c85d1144f46a9de5a1b..b8df08fe553fe9b17228a1b13b2ea00df33bc7ea 100644 (file)
@@ -1,95 +1,86 @@
-
-#ifdef __HPUX__
-#define CLI_NAME_PREFIX "_SQL"
-#endif
-
-#ifdef __AIX__
-#define CLI_NAME_PREFIX ".SQL"
-#endif
-
-#ifndef        CLI_NAME_PREFIX
+#ifndef CLI_NAME_PREFIX
 
 /* There are some exceptions :
  * on FreeBSD 2.x      CLI_NAME_PREFIX is defined in Config.mk as "_SQL"
- * on HP/UX s300/s400, CLI_NAME_PREFIX is defined in Config.mk as "_SQL" 
- * on AIX 3.x 4.x,     CLI_NAME_PREFIX is defined in Config.mk as ".SQL" 
+ * on HP/UX s300/s400, CLI_NAME_PREFIX is defined in Config.mk as "_SQL"
+ * on AIX 3.x 4.x,     CLI_NAME_PREFIX is defined in Config.mk as ".SQL"
  */
 
-#  define CLI_NAME_PREFIX      "SQL"   /* using call by value prefix */ 
+#  define CLI_NAME_PREFIX       "SQL"   /* using call by value prefix */
 #endif
 
 static struct {
-       int     en_idx;
-       char*   symbol;
+        int     en_idx;
+        char*   symbol;
 } odbcapi_symtab[] = {
 #if (ODBCVER >= 0x0300)
-       en_AllocHandle          CLI_NAME_PREFIX "AllocHandle",
-       en_FreeHandle           CLI_NAME_PREFIX "FreeHandle",
+        en_AllocHandle          CLI_NAME_PREFIX "AllocHandle",
+        en_FreeHandle           CLI_NAME_PREFIX "FreeHandle",
 #endif
-       en_AllocEnv,            CLI_NAME_PREFIX "AllocEnv",
-       en_AllocConnect,        CLI_NAME_PREFIX "AllocConnect",
-       en_Connect,             CLI_NAME_PREFIX "Connect",
-       en_DriverConnect,       CLI_NAME_PREFIX "DriverConnect",
-       en_BrowseConnect,       CLI_NAME_PREFIX "BrowseConnect",        
+        en_AllocEnv,            CLI_NAME_PREFIX "AllocEnv",
+        en_AllocConnect,        CLI_NAME_PREFIX "AllocConnect",
+        en_Connect,             CLI_NAME_PREFIX "Connect",
+        en_DriverConnect,       CLI_NAME_PREFIX "DriverConnect",
+        en_BrowseConnect,       CLI_NAME_PREFIX "BrowseConnect",
 
-       en_DataSources,         CLI_NAME_PREFIX "DataSources",
-       en_Drivers,             CLI_NAME_PREFIX "Driver",
-       en_GetInfo,             CLI_NAME_PREFIX "GetInfo",
-       en_GetFunctions,        CLI_NAME_PREFIX "GetFunctions",
-       en_GetTypeInfo,         CLI_NAME_PREFIX "GetTypeInfo",
+        en_DataSources,         CLI_NAME_PREFIX "DataSources",
+        en_Drivers,             CLI_NAME_PREFIX "Driver",
+        en_GetInfo,             CLI_NAME_PREFIX "GetInfo",
+        en_GetFunctions,        CLI_NAME_PREFIX "GetFunctions",
+        en_GetTypeInfo,         CLI_NAME_PREFIX "GetTypeInfo",
 
-       en_SetConnectOption,    CLI_NAME_PREFIX "SetConnectOption",
-       en_GetConnectOption,    CLI_NAME_PREFIX "GetConnectOption",
-       en_SetStmtOption,       CLI_NAME_PREFIX "SetStmtOption",
-       en_GetStmtOption,       CLI_NAME_PREFIX "GetStmtOption",
+        en_SetConnectOption,    CLI_NAME_PREFIX "SetConnectOption",
+        en_GetConnectOption,    CLI_NAME_PREFIX "GetConnectOption",
+        en_SetStmtOption,       CLI_NAME_PREFIX "SetStmtOption",
+        en_GetStmtOption,       CLI_NAME_PREFIX "GetStmtOption",
 
-       en_AllocStmt,           CLI_NAME_PREFIX "AllocStmt",
-       en_Prepare,             CLI_NAME_PREFIX "Prepare",
-       en_BindParameter,       CLI_NAME_PREFIX "BindParameter",
-       en_ParamOptions,        CLI_NAME_PREFIX "ParamOptions",
-       en_GetCursorName,       CLI_NAME_PREFIX "GetCursorName",
-       en_SetCursorName,       CLI_NAME_PREFIX "SetCursorName",
-       en_SetScrollOptions,    CLI_NAME_PREFIX "SetScrollOptions",
-       en_SetParam,            CLI_NAME_PREFIX "SetParam",
+        en_AllocStmt,           CLI_NAME_PREFIX "AllocStmt",
+        en_Prepare,             CLI_NAME_PREFIX "Prepare",
+        en_BindParameter,       CLI_NAME_PREFIX "BindParameter",
+        en_ParamOptions,        CLI_NAME_PREFIX "ParamOptions",
+        en_GetCursorName,       CLI_NAME_PREFIX "GetCursorName",
+        en_SetCursorName,       CLI_NAME_PREFIX "SetCursorName",
+        en_SetScrollOptions,    CLI_NAME_PREFIX "SetScrollOptions",
+        en_SetParam,            CLI_NAME_PREFIX "SetParam",
 
-       en_Execute,             CLI_NAME_PREFIX "Execute",
-       en_ExecDirect,          CLI_NAME_PREFIX "ExecDirect",
-       en_NativeSql,           CLI_NAME_PREFIX "NativeSql",
-       en_DescribeParam,       CLI_NAME_PREFIX "DescribeParam",
-       en_NumParams,           CLI_NAME_PREFIX "NumParams",
-       en_ParamData,           CLI_NAME_PREFIX "ParamData",
-       en_PutData,             CLI_NAME_PREFIX "PutData",
+        en_Execute,             CLI_NAME_PREFIX "Execute",
+        en_ExecDirect,          CLI_NAME_PREFIX "ExecDirect",
+        en_NativeSql,           CLI_NAME_PREFIX "NativeSql",
+        en_DescribeParam,       CLI_NAME_PREFIX "DescribeParam",
+        en_NumParams,           CLI_NAME_PREFIX "NumParams",
+        en_ParamData,           CLI_NAME_PREFIX "ParamData",
+        en_PutData,             CLI_NAME_PREFIX "PutData",
 
-       en_RowCount,            CLI_NAME_PREFIX "RowCount",
-       en_NumResultCols,       CLI_NAME_PREFIX "NumResultCols",
-       en_DescribeCol,         CLI_NAME_PREFIX "DescribeCol",
-       en_ColAttributes,       CLI_NAME_PREFIX "ColAttributes",
-       en_BindCol,             CLI_NAME_PREFIX "BindCol",
-       en_Fetch,               CLI_NAME_PREFIX "Fetch",
-       en_ExtendedFetch,       CLI_NAME_PREFIX "ExtendedFetch",
-       en_GetData,             CLI_NAME_PREFIX "GetData",
-       en_SetPos,              CLI_NAME_PREFIX "SetPos",
-       en_MoreResults,         CLI_NAME_PREFIX "MoreResults",
-       en_Error,               CLI_NAME_PREFIX "Error",
+        en_RowCount,            CLI_NAME_PREFIX "RowCount",
+        en_NumResultCols,       CLI_NAME_PREFIX "NumResultCols",
+        en_DescribeCol,         CLI_NAME_PREFIX "DescribeCol",
+        en_ColAttributes,       CLI_NAME_PREFIX "ColAttributes",
+        en_BindCol,             CLI_NAME_PREFIX "BindCol",
+        en_Fetch,               CLI_NAME_PREFIX "Fetch",
+        en_ExtendedFetch,       CLI_NAME_PREFIX "ExtendedFetch",
+        en_GetData,             CLI_NAME_PREFIX "GetData",
+        en_SetPos,              CLI_NAME_PREFIX "SetPos",
+        en_MoreResults,         CLI_NAME_PREFIX "MoreResults",
+        en_Error,               CLI_NAME_PREFIX "Error",
 
-       en_ColumnPrivileges,    CLI_NAME_PREFIX "ColumnPrivileges",
-       en_Columns,             CLI_NAME_PREFIX "Columns",
-       en_ForeignKeys,         CLI_NAME_PREFIX "ForeignKeys",
-       en_PrimaryKeys,         CLI_NAME_PREFIX "PrimaryKeys",
-       en_ProcedureColumns,    CLI_NAME_PREFIX "ProcedureColumns",
-       en_Procedures,          CLI_NAME_PREFIX "Procedures",
-       en_SpecialColumns,      CLI_NAME_PREFIX "SpecialColumns",
-       en_Statistics,          CLI_NAME_PREFIX "Statistics",
-       en_TablePrivileges,     CLI_NAME_PREFIX "TablePrivileges",
-       en_Tables,              CLI_NAME_PREFIX "Tables",
+        en_ColumnPrivileges,    CLI_NAME_PREFIX "ColumnPrivileges",
+        en_Columns,             CLI_NAME_PREFIX "Columns",
+        en_ForeignKeys,         CLI_NAME_PREFIX "ForeignKeys",
+        en_PrimaryKeys,         CLI_NAME_PREFIX "PrimaryKeys",
+        en_ProcedureColumns,    CLI_NAME_PREFIX "ProcedureColumns",
+        en_Procedures,          CLI_NAME_PREFIX "Procedures",
+        en_SpecialColumns,      CLI_NAME_PREFIX "SpecialColumns",
+        en_Statistics,          CLI_NAME_PREFIX "Statistics",
+        en_TablePrivileges,     CLI_NAME_PREFIX "TablePrivileges",
+        en_Tables,              CLI_NAME_PREFIX "Tables",
 
-       en_FreeStmt,            CLI_NAME_PREFIX "FreeStmt",
-       en_Cancel,              CLI_NAME_PREFIX "Cancel",
-       en_Transact,            CLI_NAME_PREFIX "Transact",
+        en_FreeStmt,            CLI_NAME_PREFIX "FreeStmt",
+        en_Cancel,              CLI_NAME_PREFIX "Cancel",
+        en_Transact,            CLI_NAME_PREFIX "Transact",
 
-       en_Disconnect,          CLI_NAME_PREFIX "Disconnect",
-       en_FreeConnect,         CLI_NAME_PREFIX "FreeConnect",
-       en_FreeEnv,             CLI_NAME_PREFIX "FreeEnv",
+        en_Disconnect,          CLI_NAME_PREFIX "Disconnect",
+        en_FreeConnect,         CLI_NAME_PREFIX "FreeConnect",
+        en_FreeEnv,             CLI_NAME_PREFIX "FreeEnv",
 
-       en_NullProc,            NULL
+        en_NullProc,            NULL
 };
index 8dc260c996a4b68ab50b854a18ab0fc6416bc7ac..191476d28d2f982e4dc61b4265a6cadd6a46c03d 100644 (file)
-#ifndef        _HENV_H
-#define        _HENV_H
+#ifndef _HENV_H
+#define _HENV_H
 
-# include      <../iodbc/config.h>
-# include      <../iodbc/dlproc.h>
+# include       <config.h>
+# include       <dlproc.h>
 
-# include      <../iodbc/isql.h>
-# include      <../iodbc/isqlext.h>
+# include       <isql.h>
+# include       <isqlext.h>
 
 enum {
 #if (ODBCVER >= 0x0300)
-       en_AllocHandle          = SQL_API_SQLALLOCHANDLE,
-       en_FreeHandle           = SQL_API_SQLFREEHANDLE,
+        en_AllocHandle          = SQL_API_SQLALLOCHANDLE,
+        en_FreeHandle           = SQL_API_SQLFREEHANDLE,
 #endif
-       en_AllocEnv             = SQL_API_SQLALLOCENV,
-       en_AllocConnect         = SQL_API_SQLALLOCCONNECT,
-       en_Connect              = SQL_API_SQLCONNECT,
-       en_DriverConnect        = SQL_API_SQLDRIVERCONNECT,
-       en_BrowseConnect        = SQL_API_SQLBROWSECONNECT,
-
-       en_DataSources          = SQL_API_SQLDATASOURCES,
-       en_Drivers              = SQL_API_SQLDRIVERS,
-       en_GetInfo              = SQL_API_SQLGETINFO,
-       en_GetFunctions         = SQL_API_SQLGETFUNCTIONS,
-       en_GetTypeInfo          = SQL_API_SQLGETTYPEINFO,
-
-       en_SetConnectOption     = SQL_API_SQLSETCONNECTOPTION,
-       en_GetConnectOption     = SQL_API_SQLGETCONNECTOPTION,
-       en_SetStmtOption        = SQL_API_SQLSETSTMTOPTION,
-       en_GetStmtOption        = SQL_API_SQLGETSTMTOPTION,
-
-       en_AllocStmt            = SQL_API_SQLALLOCSTMT,
-       en_Prepare              = SQL_API_SQLPREPARE,
-       en_BindParameter        = SQL_API_SQLBINDPARAMETER,
-       en_ParamOptions         = SQL_API_SQLPARAMOPTIONS,
-       en_GetCursorName        = SQL_API_SQLGETCURSORNAME,
-       en_SetCursorName        = SQL_API_SQLSETCURSORNAME,
-       en_SetScrollOptions     = SQL_API_SQLSETSCROLLOPTIONS,
-       en_SetParam             = SQL_API_SQLSETPARAM,
-
-       en_Execute              = SQL_API_SQLEXECUTE,
-       en_ExecDirect           = SQL_API_SQLEXECDIRECT,
-       en_NativeSql            = SQL_API_SQLNATIVESQL,
-       en_DescribeParam        = SQL_API_SQLDESCRIBEPARAM,
-       en_NumParams            = SQL_API_SQLNUMPARAMS,
-       en_ParamData            = SQL_API_SQLPARAMDATA,
-       en_PutData              = SQL_API_SQLPUTDATA,
-
-       en_RowCount             = SQL_API_SQLROWCOUNT,
-       en_NumResultCols        = SQL_API_SQLNUMRESULTCOLS,
-       en_DescribeCol          = SQL_API_SQLDESCRIBECOL,
-       en_ColAttributes        = SQL_API_SQLCOLATTRIBUTES,
-       en_BindCol              = SQL_API_SQLBINDCOL,
-       en_Fetch                = SQL_API_SQLFETCH,
-       en_ExtendedFetch        = SQL_API_SQLEXTENDEDFETCH,
-       en_GetData              = SQL_API_SQLGETDATA,
-       en_SetPos               = SQL_API_SQLSETPOS,
-       en_MoreResults          = SQL_API_SQLMORERESULTS,
-       en_Error                = SQL_API_SQLERROR,
-
-       en_ColumnPrivileges     = SQL_API_SQLCOLUMNPRIVILEGES,
-       en_Columns              = SQL_API_SQLCOLUMNS,
-       en_ForeignKeys          = SQL_API_SQLFOREIGNKEYS,
-       en_PrimaryKeys          = SQL_API_SQLPRIMARYKEYS,
-       en_ProcedureColumns     = SQL_API_SQLPROCEDURECOLUMNS,
-       en_Procedures           = SQL_API_SQLPROCEDURES,
-       en_SpecialColumns       = SQL_API_SQLSPECIALCOLUMNS,
-       en_Statistics           = SQL_API_SQLSTATISTICS,
-       en_TablePrivileges      = SQL_API_SQLTABLEPRIVILEGES,
-       en_Tables               = SQL_API_SQLTABLES,
-
-       en_FreeStmt             = SQL_API_SQLFREESTMT,
-       en_Cancel               = SQL_API_SQLCANCEL,
-       en_Transact             = SQL_API_SQLTRANSACT,
-
-       en_Disconnect           = SQL_API_SQLDISCONNECT,
-       en_FreeConnect          = SQL_API_SQLFREECONNECT,
-       en_FreeEnv              = SQL_API_SQLFREEENV,
-
-       en_NullProc             = SYSERR
+        en_AllocEnv             = SQL_API_SQLALLOCENV,
+        en_AllocConnect         = SQL_API_SQLALLOCCONNECT,
+        en_Connect              = SQL_API_SQLCONNECT,
+        en_DriverConnect        = SQL_API_SQLDRIVERCONNECT,
+        en_BrowseConnect        = SQL_API_SQLBROWSECONNECT,
+
+        en_DataSources          = SQL_API_SQLDATASOURCES,
+        en_Drivers              = SQL_API_SQLDRIVERS,
+        en_GetInfo              = SQL_API_SQLGETINFO,
+        en_GetFunctions         = SQL_API_SQLGETFUNCTIONS,
+        en_GetTypeInfo          = SQL_API_SQLGETTYPEINFO,
+
+        en_SetConnectOption     = SQL_API_SQLSETCONNECTOPTION,
+        en_GetConnectOption     = SQL_API_SQLGETCONNECTOPTION,
+        en_SetStmtOption        = SQL_API_SQLSETSTMTOPTION,
+        en_GetStmtOption        = SQL_API_SQLGETSTMTOPTION,
+
+        en_AllocStmt            = SQL_API_SQLALLOCSTMT,
+        en_Prepare              = SQL_API_SQLPREPARE,
+        en_BindParameter        = SQL_API_SQLBINDPARAMETER,
+        en_ParamOptions         = SQL_API_SQLPARAMOPTIONS,
+        en_GetCursorName        = SQL_API_SQLGETCURSORNAME,
+        en_SetCursorName        = SQL_API_SQLSETCURSORNAME,
+        en_SetScrollOptions     = SQL_API_SQLSETSCROLLOPTIONS,
+        en_SetParam             = SQL_API_SQLSETPARAM,
+
+        en_Execute              = SQL_API_SQLEXECUTE,
+        en_ExecDirect           = SQL_API_SQLEXECDIRECT,
+        en_NativeSql            = SQL_API_SQLNATIVESQL,
+        en_DescribeParam        = SQL_API_SQLDESCRIBEPARAM,
+        en_NumParams            = SQL_API_SQLNUMPARAMS,
+        en_ParamData            = SQL_API_SQLPARAMDATA,
+        en_PutData              = SQL_API_SQLPUTDATA,
+
+        en_RowCount             = SQL_API_SQLROWCOUNT,
+        en_NumResultCols        = SQL_API_SQLNUMRESULTCOLS,
+        en_DescribeCol          = SQL_API_SQLDESCRIBECOL,
+        en_ColAttributes        = SQL_API_SQLCOLATTRIBUTES,
+        en_BindCol              = SQL_API_SQLBINDCOL,
+        en_Fetch                = SQL_API_SQLFETCH,
+        en_ExtendedFetch        = SQL_API_SQLEXTENDEDFETCH,
+        en_GetData              = SQL_API_SQLGETDATA,
+        en_SetPos               = SQL_API_SQLSETPOS,
+        en_MoreResults          = SQL_API_SQLMORERESULTS,
+        en_Error                = SQL_API_SQLERROR,
+
+        en_ColumnPrivileges     = SQL_API_SQLCOLUMNPRIVILEGES,
+        en_Columns              = SQL_API_SQLCOLUMNS,
+        en_ForeignKeys          = SQL_API_SQLFOREIGNKEYS,
+        en_PrimaryKeys          = SQL_API_SQLPRIMARYKEYS,
+        en_ProcedureColumns     = SQL_API_SQLPROCEDURECOLUMNS,
+        en_Procedures           = SQL_API_SQLPROCEDURES,
+        en_SpecialColumns       = SQL_API_SQLSPECIALCOLUMNS,
+        en_Statistics           = SQL_API_SQLSTATISTICS,
+        en_TablePrivileges      = SQL_API_SQLTABLEPRIVILEGES,
+        en_Tables               = SQL_API_SQLTABLES,
+
+        en_FreeStmt             = SQL_API_SQLFREESTMT,
+        en_Cancel               = SQL_API_SQLCANCEL,
+        en_Transact             = SQL_API_SQLTRANSACT,
+
+        en_Disconnect           = SQL_API_SQLDISCONNECT,
+        en_FreeConnect          = SQL_API_SQLFREECONNECT,
+        en_FreeEnv              = SQL_API_SQLFREEENV,
+
+        en_NullProc             = SYSERR
 };
 
-typedef        struct {
-       int     type;   /* must be 1st field */
+typedef struct {
+        int     type;   /* must be 1st field */
 
-       HENV    henv;   /* driver's env list */
-       HDBC    hdbc;   /* driver's dbc list */
-       HERR    herr;   /* err list          */
-       int     state;
+        HENV    henv;   /* driver's env list */
+        HDBC    hdbc;   /* driver's dbc list */
+        HERR    herr;   /* err list          */
+        int     state;
 } GENV_t;
 
-typedef        struct {
-       HENV    next;                   /* next attached env handle */
-       int     refcount;               /* Driver's bookkeeping reference count */ 
-       HPROC   dllproc_tab[SQL_EXT_API_LAST + 1]; /* driver api calls  */
+typedef struct {
+        HENV    next;                   /* next attached env handle */
+        int     refcount;               /* Driver's bookkeeping reference count */
+        HPROC   dllproc_tab[SQL_EXT_API_LAST + 1]; /* driver api calls  */
 
-       HENV    dhenv;                  /* driver env handle    */
-       HDLL    hdll;                   /* drvier share library handle */
+        HENV    dhenv;                  /* driver env handle    */
+        HDLL    hdll;                   /* driver share library handle */
 } ENV_t;
 
 /* Note:
  *
- *  - ODBC applications only know about global environment handle, 
+ *  - ODBC applications only know about global environment handle,
  *    a void pointer points to a GENV_t object. There is only one
  *    this object per process(however, to make the library reentrant,
- *    we still keep this object on heap). Applications only know 
+ *    we still keep this object on heap). Applications only know
  *    address of this object and needn't care about its detail.
  *
  *  - ODBC driver manager knows about instance environment handles,
@@ -120,6 +120,6 @@ typedef     struct {
  *
  *  - Applications can get driver's environment object handle by
  *    SQLGetInfo() with fInfoType equals to SQL_DRIVER_HENV
- */  
+ */
 
 #endif
index 9c299e65976860dc608f8920dc4073cafffcc188..b860b834b0998d0d05493e786c7a05ecd9b3331f 100644 (file)
@@ -1,6 +1,6 @@
 /** Error stack management functions
-  
-    Copyright (C) 1995 by Ke Jin <kejin@empress.com> 
+
+    Copyright (C) 1995 by Ke Jin <kejin@empress.com>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 #include        <strings.h>
 #include        <stdio.h>
 
-static HERR    _iodbcdm_popsqlerr( HERR herr )
+static  HERR    _iodbcdm_popsqlerr( HERR herr )
 {
-       sqlerr_t*       list = (sqlerr_t*)herr;
-       sqlerr_t*       next;
+        sqlerr_t*       list = (sqlerr_t*)herr;
+        sqlerr_t*       next;
+
+        if( herr == SQL_NULL_HERR )
+        {
+                return herr;
+        }
 
-       if( herr == SQL_NULL_HERR )
-       {
-               return herr;
-       }
-       
-       next = list->next;
+        next = list->next;
 
-       MEM_FREE (list);
+        MEM_FREE (list);
 
-       return next;
+        return next;
 }
 
-void   _iodbcdm_freesqlerrlist( HERR herrlist )
+void    _iodbcdm_freesqlerrlist( HERR herrlist )
 {
-       HERR    list;
+        HERR    list;
 
-       for(list = herrlist; list!= 0; )
-       {
-               list = _iodbcdm_popsqlerr(list);
-       }
+        for(list = herrlist; list!= 0; )
+        {
+                list = _iodbcdm_popsqlerr(list);
+        }
 }
 
-HERR   _iodbcdm_pushsqlerr ( 
-               HERR            herr,
-               sqlstcode_t     code,
-               char*           msg )
+HERR    _iodbcdm_pushsqlerr (
+                HERR            herr,
+                sqlstcode_t     code,
+                char*           msg )
 {
-       sqlerr_t*       ebuf;
-       sqlerr_t*       perr    = (sqlerr_t*)herr;
-       int             idx     = 0;
-
-       if(herr != SQL_NULL_HERR )
-       {
-               idx = perr->idx + 1;
-       }
-
-       if( idx == 64 )         
-       /* over wirte the top entry to prevent error stack blow out */
-       {
-               perr->code = code;
-               perr->msg  = msg;
-
-               return herr;
-       }
-
-       ebuf = (sqlerr_t*)MEM_ALLOC (sizeof(sqlerr_t)); 
-       
-       if( ebuf == NULL )
-       {
-               return NULL;
-       }
-
-       ebuf->msg       = msg;  
-       ebuf->code      = code;
-       ebuf->idx       = idx;
-       ebuf->next      = (sqlerr_t*)herr;
-
-       return (HERR)ebuf;
+        sqlerr_t*       ebuf;
+        sqlerr_t*       perr    = (sqlerr_t*)herr;
+        int             idx     = 0;
+
+        if(herr != SQL_NULL_HERR )
+        {
+                idx = perr->idx + 1;
+        }
+
+        if( idx == 64 )
+        /* over wirte the top entry to prevent error stack blow out */
+        {
+                perr->code = code;
+                perr->msg  = msg;
+
+                return herr;
+        }
+
+        ebuf = (sqlerr_t*)MEM_ALLOC (sizeof(sqlerr_t));
+
+        if( ebuf == NULL )
+        {
+                return NULL;
+        }
+
+        ebuf->msg       = msg;
+        ebuf->code      = code;
+        ebuf->idx       = idx;
+        ebuf->next      = (sqlerr_t*)herr;
+
+        return (HERR)ebuf;
 }
 
-static char FAR*       _iodbcdm_getsqlstate ( 
-                               HERR            herr, 
-                               void FAR*       tab )
+static  char FAR*       _iodbcdm_getsqlstate (
+                                HERR            herr,
+                                void FAR*       tab )
 {
-       sqlerr_t*       perr = (sqlerr_t*)herr;
-       sqlerrmsg_t*    ptr;
-
-       if( herr == SQL_NULL_HERR || tab == NULL )
-       {
-               return (char FAR*)NULL;
-       }
-
-       for( ptr = tab;
-            ptr->code != en_sqlstat_total;
-            ptr++ )
-       {
-               if(ptr->code == perr->code)
-               {
-                       return (char FAR*)(ptr->stat);
-               }
-       }
-
-       return (char FAR*)NULL;
+        sqlerr_t*       perr = (sqlerr_t*)herr;
+        sqlerrmsg_t*    ptr;
+
+        if( herr == SQL_NULL_HERR || tab == NULL )
+        {
+                return (char FAR*)NULL;
+        }
+
+        for( ptr = tab;
+             ptr->code != en_sqlstat_total;
+             ptr++ )
+        {
+                if(ptr->code == perr->code)
+                {
+                        return (char FAR*)(ptr->stat);
+                }
+        }
+
+        return (char FAR*)NULL;
 }
 
-static char FAR*       _iodbcdm_getsqlerrmsg(
-                               HERR            herr,
-                               void FAR*       errtab )
+static char FAR*        _iodbcdm_getsqlerrmsg(
+                                HERR            herr,
+                                void FAR*       errtab )
 {
         sqlerr_t*       perr = (sqlerr_t*)herr;
-       sqlerrmsg_t*    ptr;
+        sqlerrmsg_t*    ptr;
 
         if( herr == SQL_NULL_HERR )
         {
                 return NULL;
         }
 
-       if( perr->msg == NULL && errtab == NULL )
-       {
-               return NULL;
-       }
-
-       if( perr->msg != NULL )
-       {
-               return perr->msg;
-       }
-
-       for( ptr = (sqlerrmsg_t*)errtab;
-            ptr->code != en_sqlstat_total;
-            ptr++ )
-       {
-               if( ptr->code == perr->code )
-               {
-                       return (char FAR*)ptr->msg;
-               }
-       }
-
-       return (char FAR*)NULL;
+        if( perr->msg == NULL && errtab == NULL )
+        {
+                return NULL;
+        }
+
+        if( perr->msg != NULL )
+        {
+                return perr->msg;
+        }
+
+        for( ptr = (sqlerrmsg_t*)errtab;
+             ptr->code != en_sqlstat_total;
+             ptr++ )
+        {
+                if( ptr->code == perr->code )
+                {
+                        return (char FAR*)ptr->msg;
+                }
+        }
+
+        return (char FAR*)NULL;
 }
 
-RETCODE SQL_API        SQLError (
-                       HENV            henv,
-                       HDBC            hdbc,
-                       HSTMT           hstmt,
-                       UCHAR FAR*      szSqlstate,
-                       SDWORD FAR*     pfNativeError,
-                       UCHAR FAR*      szErrorMsg,
-                       SWORD           cbErrorMsgMax,
-                       SWORD FAR*      pcbErrorMsg )
+RETCODE SQL_API SQLError (
+                        HENV            henv,
+                        HDBC            hdbc,
+                        HSTMT           hstmt,
+                        UCHAR FAR*      szSqlstate,
+                        SDWORD FAR*     pfNativeError,
+                        UCHAR FAR*      szErrorMsg,
+                        SWORD           cbErrorMsgMax,
+                        SWORD FAR*      pcbErrorMsg )
 {
-       GENV_t FAR*     genv    = (GENV_t FAR*) henv;
-       DBC_t  FAR*     pdbc    = (DBC_t FAR*) hdbc;
-       STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
-       HDBC            thdbc;
-
-       HENV            dhenv   = SQL_NULL_HENV;
-       HDBC            dhdbc   = SQL_NULL_HDBC;
-       HSTMT           dhstmt  = SQL_NULL_HSTMT;
-
-       HERR            herr    = SQL_NULL_HERR;
-       HPROC           hproc   = SQL_NULL_HPROC;
-
-       char   FAR*     errmsg  = NULL;
-       char   FAR*     ststr   = NULL;
-
-       int             handle  = 0;
-       RETCODE         retcode = SQL_SUCCESS;
-       
-       if( hstmt != SQL_NULL_HSTMT )   /* retrive stmt err */
-       {
-               herr    = pstmt->herr;
-               thdbc   = pstmt->hdbc;
-
-               if( thdbc == SQL_NULL_HDBC )
-               {
-                       return SQL_INVALID_HANDLE;
-               }       
-               hproc   = _iodbcdm_getproc( thdbc, en_Error );
-               dhstmt  = pstmt->dhstmt;
-               handle  = 3;
-       }
-       else if( hdbc != SQL_NULL_HDBC )        /* retrive dbc err */
-       {
-               herr    = pdbc->herr;
-               thdbc   = hdbc;
-               if( thdbc == SQL_NULL_HDBC )
-               {
-                       return SQL_INVALID_HANDLE;
-               }
-               hproc   = _iodbcdm_getproc( thdbc, en_Error );
-               dhdbc   = pdbc->dhdbc;
-               handle  = 2;
-
-               if( herr == SQL_NULL_HERR
-                && pdbc->henv == SQL_NULL_HENV )
-               {
-                       return SQL_NO_DATA_FOUND;
-               }
-       }
-       else if( henv != SQL_NULL_HENV )        /* retrive env err */
-       {
-               herr    = genv->herr;
-
-               /* Drivers shouldn't push error message 
-                * on envoriment handle */
-
-               if( herr == SQL_NULL_HERR )
-               {
-                       return SQL_NO_DATA_FOUND;
-               }
-
-               handle = 1;
-       }
-       else
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       if( szErrorMsg != NULL )
-       {
-               if( cbErrorMsgMax < 0
-                || cbErrorMsgMax > SQL_MAX_MESSAGE_LENGTH - 1 )
-               {
-                       return SQL_ERROR;
-                       /* SQLError() doesn't post error for itself */
-               }
-       }
-
-       if( herr == SQL_NULL_HERR )             /* no err on drv mng */
-       {
-               /* call driver */
-               if( hproc == SQL_NULL_HPROC )
-               {
-                       PUSHSQLERR ( herr, en_IM001 );
-
-                       return SQL_ERROR;
-               }
-
-               CALL_DRIVER ( thdbc, retcode, hproc, en_Error, (
-                               dhenv, dhdbc, dhstmt, 
-                               szSqlstate, pfNativeError, 
-                               szErrorMsg, cbErrorMsgMax, pcbErrorMsg) )
+        GENV_t FAR*     genv    = (GENV_t FAR*) henv;
+        DBC_t  FAR*     pdbc    = (DBC_t FAR*) hdbc;
+        STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
+        HDBC            thdbc;
+
+        HENV            dhenv   = SQL_NULL_HENV;
+        HDBC            dhdbc   = SQL_NULL_HDBC;
+        HSTMT           dhstmt  = SQL_NULL_HSTMT;
+
+        HERR            herr    = SQL_NULL_HERR;
+        HPROC           hproc   = SQL_NULL_HPROC;
+
+        char   FAR*     errmsg  = NULL;
+        char   FAR*     ststr   = NULL;
+
+        int             handle  = 0;
+        RETCODE         retcode = SQL_SUCCESS;
+
+        if( hstmt != SQL_NULL_HSTMT )   /* retrive stmt err */
+        {
+                herr    = pstmt->herr;
+                thdbc   = pstmt->hdbc;
+
+                if( thdbc == SQL_NULL_HDBC )
+                {
+                        return SQL_INVALID_HANDLE;
+                }
+                hproc   = _iodbcdm_getproc( thdbc, en_Error );
+                dhstmt  = pstmt->dhstmt;
+                handle  = 3;
+        }
+        else if( hdbc != SQL_NULL_HDBC )        /* retrive dbc err */
+        {
+                herr    = pdbc->herr;
+                thdbc   = hdbc;
+                if( thdbc == SQL_NULL_HDBC )
+                {
+                        return SQL_INVALID_HANDLE;
+                }
+                hproc   = _iodbcdm_getproc( thdbc, en_Error );
+                dhdbc   = pdbc->dhdbc;
+                handle  = 2;
+
+                if( herr == SQL_NULL_HERR
+                 && pdbc->henv == SQL_NULL_HENV )
+                {
+                        return SQL_NO_DATA_FOUND;
+                }
+        }
+        else if( henv != SQL_NULL_HENV )        /* retrive env err */
+        {
+                herr    = genv->herr;
+
+                /* Drivers shouldn't push error message
+                 * on envoriment handle */
+
+                if( herr == SQL_NULL_HERR )
+                {
+                        return SQL_NO_DATA_FOUND;
+                }
+
+                handle = 1;
+        }
+        else
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        if( szErrorMsg != NULL )
+        {
+                if( cbErrorMsgMax < 0
+                 || cbErrorMsgMax > SQL_MAX_MESSAGE_LENGTH - 1 )
+                {
+                        return SQL_ERROR;
+                        /* SQLError() doesn't post error for itself */
+                }
+        }
+
+        if( herr == SQL_NULL_HERR )             /* no err on drv mng */
+        {
+                /* call driver */
+                if( hproc == SQL_NULL_HPROC )
+                {
+                        PUSHSQLERR ( herr, en_IM001 );
+
+                        return SQL_ERROR;
+                }
+
+                CALL_DRIVER ( thdbc, retcode, hproc, en_Error, (
+                                dhenv, dhdbc, dhstmt,
+                                szSqlstate, pfNativeError,
+                                szErrorMsg, cbErrorMsgMax, pcbErrorMsg) )
 
 #if 0
-               retcode = hproc(dhenv, dhdbc, dhstmt, 
-                               szSqlstate, pfNativeError, 
-                               szErrorMsg, cbErrorMsgMax, pcbErrorMsg);
+                retcode = hproc(dhenv, dhdbc, dhstmt,
+                                szSqlstate, pfNativeError,
+                                szErrorMsg, cbErrorMsgMax, pcbErrorMsg);
 #endif
 
-               return retcode;
-       }
-
-       if( szSqlstate != NULL )
-       {
-               int     len;
-
-               /* get sql state  string */
-               ststr = (char FAR*)_iodbcdm_getsqlstate( herr, 
-                               (void FAR*)sqlerrmsg_tab );
-       
-               if( ststr == NULL)
-               {
-                       len = 0;
-               }
-               else
-               {
-                       len = (int)STRLEN(ststr);
-               }
-       
-               STRNCPY ( szSqlstate, ststr, len );
-               szSqlstate[len] = 0;
-               /* buffer size of szSqlstate is not checked. Applications
-                * suppose provide enough ( not less than 6 bytes ) buffer
-                * or NULL for it.
-                */
-       }
-
-       if( pfNativeError != NULL )
-       {
-               /* native error code is specific to data source */
-               *pfNativeError = (SDWORD)0L;
-       }
-
-       if( szErrorMsg == NULL || cbErrorMsgMax == 0 )
-       {
-               if( pcbErrorMsg != NULL )
-               {
-                       *pcbErrorMsg = (SWORD)0;
-               }
-       }
-       else
-       {
-               int     len;
-               char    msgbuf[256] = { '\0' };
-
-               /* get sql state message */
-               errmsg = _iodbcdm_getsqlerrmsg(herr, 
-                               (void FAR*)sqlerrmsg_tab);
-
-               if(errmsg == NULL)
-               {
-                       errmsg = (char FAR*)"";
-               }       
-
-               sprintf(msgbuf, "%s%s", sqlerrhd, errmsg); 
-       
-               len = STRLEN( msgbuf );
-
-               if( len < cbErrorMsgMax - 1 )
-               {
-                       retcode = SQL_SUCCESS;
-               }
-               else
-               {
-                       len = cbErrorMsgMax - 1;
-                       retcode = SQL_SUCCESS_WITH_INFO;
-                       /* and not posts error for itself */
-               }
-
-               STRNCPY((char*)szErrorMsg, msgbuf, len);
-               szErrorMsg[len] = 0;
-
-               if( pcbErrorMsg != NULL)
-               {
-                       *pcbErrorMsg = (SWORD)len;
-               }
-       }
-
-       switch(handle)          /* free this err */
-       {
-               case 1:
-                       genv->herr = _iodbcdm_popsqlerr(genv->herr);
-                       break;
-
-               case 2:
-                       pdbc->herr = _iodbcdm_popsqlerr(pdbc->herr);
-                       break;
-
-               case 3: 
-                       pstmt->herr= _iodbcdm_popsqlerr(pstmt->herr);
-                       break;
-
-               default:
-                       break;
-       }
-
-       return retcode;
+                return retcode;
+        }
+
+        if( szSqlstate != NULL )
+        {
+                int     len;
+
+                /* get sql state  string */
+                ststr = (char FAR*)_iodbcdm_getsqlstate( herr,
+                                (void FAR*)sqlerrmsg_tab );
+
+                if( ststr == NULL)
+                {
+                        len = 0;
+                }
+                else
+                {
+                        len = (int)STRLEN(ststr);
+                }
+
+                STRNCPY ( szSqlstate, ststr, len );
+                szSqlstate[len] = 0;
+                /* buffer size of szSqlstate is not checked. Applications
+                 * suppose provide enough ( not less than 6 bytes ) buffer
+                 * or NULL for it.
+                 */
+        }
+
+        if( pfNativeError != NULL )
+        {
+                /* native error code is specific to data source */
+                *pfNativeError = (SDWORD)0L;
+        }
+
+        if( szErrorMsg == NULL || cbErrorMsgMax == 0 )
+        {
+                if( pcbErrorMsg != NULL )
+                {
+                        *pcbErrorMsg = (SWORD)0;
+                }
+        }
+        else
+        {
+                int     len;
+                char    msgbuf[256] = { '\0' };
+
+                /* get sql state message */
+                errmsg = _iodbcdm_getsqlerrmsg(herr,
+                                (void FAR*)sqlerrmsg_tab);
+
+                if(errmsg == NULL)
+                {
+                        errmsg = (char FAR*)"";
+                }
+
+                sprintf(msgbuf, "%s%s", sqlerrhd, errmsg);
+
+                len = STRLEN( msgbuf );
+
+                if( len < cbErrorMsgMax - 1 )
+                {
+                        retcode = SQL_SUCCESS;
+                }
+                else
+                {
+                        len = cbErrorMsgMax - 1;
+                        retcode = SQL_SUCCESS_WITH_INFO;
+                        /* and not posts error for itself */
+                }
+
+                STRNCPY((char*)szErrorMsg, msgbuf, len);
+                szErrorMsg[len] = 0;
+
+                if( pcbErrorMsg != NULL)
+                {
+                        *pcbErrorMsg = (SWORD)len;
+                }
+        }
+
+        switch(handle)          /* free this err */
+        {
+                case 1:
+                        genv->herr = _iodbcdm_popsqlerr(genv->herr);
+                        break;
+
+                case 2:
+                        pdbc->herr = _iodbcdm_popsqlerr(pdbc->herr);
+                        break;
+
+                case 3:
+                        pstmt->herr= _iodbcdm_popsqlerr(pstmt->herr);
+                        break;
+
+                default:
+                        break;
+        }
+
+        return retcode;
 }
index d5028509330c33f36cecc02afa765931f5e8c30e..b9dbe0ba75b3790b684766c0b9d879f366f39f79 100644 (file)
@@ -1,98 +1,98 @@
 static const sqlerrmsg_t sqlerrmsg_tab[] =
 {
-       en_00000, "00000", "",
-       en_01000, "01000", "General warning",
-       en_01002, "01002", "Disconnect error",
-       en_01004, "01004", "Data truncated",
-       en_01006, "01006", "Privilege not revoked",
-       en_01S00, "01S00", "Invalid connection string attribute",
-       en_01S01, "01S01", "Error in row",
-       en_01S02, "01S02", "Optional value changed",
-       en_01S03, "01S03", "No rows updated or deleted",
-       en_01S04, "01S04", "More than one row updated or deleted",
-       en_07001, "07001", "Wrong number of parameters",
-       en_07006, "07006", "Restricted data type attribute violation",
-       en_08001, "08001", "Unable to connect to data source",
-       en_08002, "08002", "Connection in use",
-       en_08003, "08003", "Connect not open",
-       en_08004, "08004", "Data source rejected establishment of connection",
-       en_08007, "08007", "Connection failure during transaction",
-       en_08S01, "08S01", "Communication link failure",
-       en_21S01, "21S01", "Insert value list does not match",
-       en_21S02, "21S02", "Degree of derived table does not match column list",
-       en_22001, "22001", "String data right truncation",
-       en_22003, "22003", "Numeric value out of range",
-       en_22005, "22005", "Error in assignment",
-       en_22008, "22008", "Datetime field overflow",
-       en_22012, "22012", "Division by zero",
-       en_22026, "22026", "String data, length mismatch",
-       en_23000, "23000", "Integrity constraint violation",
-       en_24000, "24000", "Invalid cursor state",
-       en_25000, "25000", "Invalid transaction state",
-       en_28000, "28000", "Invalid authorization specification",
-       en_34000, "34000", "Invalid cursor name",
-       en_37000, "37000", "Syntex error or access violation",
-       en_3C000, "3C000", "Duplicate cursor name",
-       en_40001, "40001", "Serialization failure",
-       en_42000, "42000", "Syntax error or access violation",
-       en_70100, "70100", "Operation aborted",
-       en_IM001, "IM001", "Driver does not support this function",
-       en_IM002, "IM002", "Data source name not found and no default "
-                          "driver specified. Driver could not be loaded",
-       en_IM003, "IM003", "Specified driver could not be loaded",
-       en_IM004, "IM004", "Driver's SQLAllocEnv() failed",
-       en_IM005, "IM005", "Driver's SQLAllocConnect() failed",
-       en_IM006, "IM006", "Driver's SQLSetConnectOption failed",
-       en_IM007, "IM007", "No data source or driver specified, dialog prohibited",
-       en_IM008, "IM008", "Dialog failed",
-       en_IM009, "IM009", "Unable to load translation DLL",
-       en_IM010, "IM010", "Data source name too long",
-       en_IM011, "IM011", "Driver name too long",
-       en_IM012, "IM012", "DRIVER keyword syntax error",
-       en_IM013, "IM013", "Trace file error",
-       en_IM014, "IM014", "Try to change tracing file while tracing is on",
-       en_S0001, "S0001", "Base table or view already exists",
-       en_S0002, "S0002", "Base table not found",
-       en_S0011, "S0011", "Index already exists",
-       en_S0012, "S0012", "Index not found",
-       en_S0021, "S0021", "Column already exists",
-       en_S0022, "S0022", "Column not found",
-       en_S0023, "S0023", "No default for column",
-       en_S1000, "S1000", "General error",
-       en_S1001, "S1001", "Memory allocation failure",
-       en_S1002, "S1002", "Invalid column number",
-       en_S1003, "S1003", "Program type out of range",
-       en_S1004, "S1004", "SQL data type out of range",
-       en_S1008, "S1008", "Operation canceled",
-       en_S1009, "S1009", "Invalid argument value",
-       en_S1010, "S1010", "Function sequence error",
-       en_S1011, "S1011", "Operation invalid at this time",
-       en_S1012, "S1012", "Invalid transaction operation code specified",
-       en_S1015, "S1015", "No cursor name available",
-       en_S1090, "S1090", "Invalid string or buffer length",
-       en_S1091, "S1091", "Descriptor type out of range",
-       en_S1092, "S1092", "Option type out of range",
-       en_S1093, "S1093", "Invalid parameter",
-       en_S1094, "S1094", "Invalid scale value",
-       en_S1095, "S1095", "Function type out of range",
-       en_S1096, "S1096", "Information type out of range",
-       en_S1097, "S1097", "Column type out of range",
-       en_S1098, "S1098", "Scope type out of range",
-       en_S1099, "S1099", "Nullable type out of range",
-       en_S1100, "S1100", "Uniquenss option type out of range",
-       en_S1101, "S1101", "Accuracy option type out of range",
-       en_S1103, "S1103", "Direction option out of range",
-       en_S1104, "S1104", "Invalid precision value",
-       en_S1105, "S1105", "Invalid parameter type",
-       en_S1106, "S1106", "Fetch type out of range",
-       en_S1107, "S1107", "Row value out of range",
-       en_S1108, "S1108", "Concurrency option out of range",
-       en_S1109, "S1109", "Invalid cursor position",
-       en_S1110, "S1110", "Invalid driver completion",
-       en_S1111, "S1111", "Invalid bookmark value",
-       en_S1C00, "S1C00", "Driver not capable",
-       en_S1T00, "S1T00", "Timeout expired",
-       en_sqlstat_total,   NULL,            NULL 
+        en_00000, "00000", "",
+        en_01000, "01000", "General warning",
+        en_01002, "01002", "Disconnect error",
+        en_01004, "01004", "Data truncated",
+        en_01006, "01006", "Privilege not revoked",
+        en_01S00, "01S00", "Invalid connection string attribute",
+        en_01S01, "01S01", "Error in row",
+        en_01S02, "01S02", "Optional value changed",
+        en_01S03, "01S03", "No rows updated or deleted",
+        en_01S04, "01S04", "More than one row updated or deleted",
+        en_07001, "07001", "Wrong number of parameters",
+        en_07006, "07006", "Restricted data type attribute violation",
+        en_08001, "08001", "Unable to connect to data source",
+        en_08002, "08002", "Connection in use",
+        en_08003, "08003", "Connect not open",
+        en_08004, "08004", "Data source rejected establishment of connection",
+        en_08007, "08007", "Connection failure during transaction",
+        en_08S01, "08S01", "Communication link failure",
+        en_21S01, "21S01", "Insert value list does not match",
+        en_21S02, "21S02", "Degree of derived table does not match column list",
+        en_22001, "22001", "String data right truncation",
+        en_22003, "22003", "Numeric value out of range",
+        en_22005, "22005", "Error in assignment",
+        en_22008, "22008", "Datetime field overflow",
+        en_22012, "22012", "Division by zero",
+        en_22026, "22026", "String data, length mismatch",
+        en_23000, "23000", "Integrity constraint violation",
+        en_24000, "24000", "Invalid cursor state",
+        en_25000, "25000", "Invalid transaction state",
+        en_28000, "28000", "Invalid authorization specification",
+        en_34000, "34000", "Invalid cursor name",
+        en_37000, "37000", "Syntex error or access violation",
+        en_3C000, "3C000", "Duplicate cursor name",
+        en_40001, "40001", "Serialization failure",
+        en_42000, "42000", "Syntax error or access violation",
+        en_70100, "70100", "Operation aborted",
+        en_IM001, "IM001", "Driver does not support this function",
+        en_IM002, "IM002", "Data source name not found and no default "
+                           "driver specified. Driver could not be loaded",
+        en_IM003, "IM003", "Specified driver could not be loaded",
+        en_IM004, "IM004", "Driver's SQLAllocEnv() failed",
+        en_IM005, "IM005", "Driver's SQLAllocConnect() failed",
+        en_IM006, "IM006", "Driver's SQLSetConnectOption failed",
+        en_IM007, "IM007", "No data source or driver specified, dialog prohibited",
+        en_IM008, "IM008", "Dialog failed",
+        en_IM009, "IM009", "Unable to load translation DLL",
+        en_IM010, "IM010", "Data source name too long",
+        en_IM011, "IM011", "Driver name too long",
+        en_IM012, "IM012", "DRIVER keyword syntax error",
+        en_IM013, "IM013", "Trace file error",
+        en_IM014, "IM014", "Try to change tracing file while tracing is on",
+        en_S0001, "S0001", "Base table or view already exists",
+        en_S0002, "S0002", "Base table not found",
+        en_S0011, "S0011", "Index already exists",
+        en_S0012, "S0012", "Index not found",
+        en_S0021, "S0021", "Column already exists",
+        en_S0022, "S0022", "Column not found",
+        en_S0023, "S0023", "No default for column",
+        en_S1000, "S1000", "General error",
+        en_S1001, "S1001", "Memory allocation failure",
+        en_S1002, "S1002", "Invalid column number",
+        en_S1003, "S1003", "Program type out of range",
+        en_S1004, "S1004", "SQL data type out of range",
+        en_S1008, "S1008", "Operation canceled",
+        en_S1009, "S1009", "Invalid argument value",
+        en_S1010, "S1010", "Function sequence error",
+        en_S1011, "S1011", "Operation invalid at this time",
+        en_S1012, "S1012", "Invalid transaction operation code specified",
+        en_S1015, "S1015", "No cursor name available",
+        en_S1090, "S1090", "Invalid string or buffer length",
+        en_S1091, "S1091", "Descriptor type out of range",
+        en_S1092, "S1092", "Option type out of range",
+        en_S1093, "S1093", "Invalid parameter",
+        en_S1094, "S1094", "Invalid scale value",
+        en_S1095, "S1095", "Function type out of range",
+        en_S1096, "S1096", "Information type out of range",
+        en_S1097, "S1097", "Column type out of range",
+        en_S1098, "S1098", "Scope type out of range",
+        en_S1099, "S1099", "Nullable type out of range",
+        en_S1100, "S1100", "Uniquenss option type out of range",
+        en_S1101, "S1101", "Accuracy option type out of range",
+        en_S1103, "S1103", "Direction option out of range",
+        en_S1104, "S1104", "Invalid precision value",
+        en_S1105, "S1105", "Invalid parameter type",
+        en_S1106, "S1106", "Fetch type out of range",
+        en_S1107, "S1107", "Row value out of range",
+        en_S1108, "S1108", "Concurrency option out of range",
+        en_S1109, "S1109", "Invalid cursor position",
+        en_S1110, "S1110", "Invalid driver completion",
+        en_S1111, "S1111", "Invalid bookmark value",
+        en_S1C00, "S1C00", "Driver not capable",
+        en_S1T00, "S1T00", "Timeout expired",
+        en_sqlstat_total,   NULL,            NULL
 };
 
-static char FAR*       sqlerrhd = "[iODBC][Driver Manager]";
+static char FAR*        sqlerrhd = "[iODBC][Driver Manager]";
index e01941d463c63fff93087800fc00d96fe56fd374..0ab2c1c66edebe316d15a25b06e93d05ae636e37 100644 (file)
-#ifndef        _HERR_H
-#define        _HERR_H
+#ifndef _HERR_H
+#define _HERR_H
 
 typedef enum {
-       en_00000 = 0, 
-       en_01000, 
-       en_01002, 
-       en_01004, 
-       en_01006, 
-       en_01S00, 
-       en_01S01, 
-       en_01S02, 
-       en_01S03, 
-       en_01S04, 
-       en_07001, 
-       en_07006, 
-       en_08001, 
-       en_08002, 
-       en_08003, 
-       en_08004, 
-       en_08007, 
-       en_08S01, 
-       en_21S01, 
-       en_21S02, 
-       en_22001, 
-       en_22003, 
-       en_22005, 
-       en_22008, 
-       en_22012, 
-       en_22026, 
-       en_23000, 
-       en_24000,
-       en_25000,
-       en_28000,
-       en_34000,
-       en_37000,
-       en_3C000,
-       en_40001,
-       en_42000,
-       en_70100,
-       en_IM001,
-       en_IM002,
-       en_IM003,
-       en_IM004,
-       en_IM005,
-       en_IM006,
-       en_IM007,
-       en_IM008,
-       en_IM009,
-       en_IM010,
-       en_IM011,
-       en_IM012,
-       en_IM013,
-       en_IM014,
-       en_S0001,
-       en_S0002,
-       en_S0011,
-       en_S0012,
-       en_S0021,
-       en_S0022,
-       en_S0023,
-       en_S1000,
-       en_S1001,
-       en_S1002, 
-       en_S1003, 
-       en_S1004, 
-       en_S1008, 
-       en_S1009,
-       en_S1010,
-       en_S1011,
-       en_S1012,
-       en_S1015,
-       en_S1090,
-       en_S1091,
-       en_S1092,
-       en_S1093, 
-       en_S1094,
-       en_S1095, 
-       en_S1096,
-       en_S1097,
-       en_S1098,
-       en_S1099, 
-       en_S1100,
-       en_S1101,
-       en_S1103,
-       en_S1104,
-       en_S1105, 
-       en_S1106,
-       en_S1107,
-       en_S1108,
-       en_S1109,
-       en_S1110, 
-       en_S1111, 
-       en_S1C00,
-       en_S1T00,
-       en_sqlstat_total
+        en_00000 = 0,
+        en_01000,
+        en_01002,
+        en_01004,
+        en_01006,
+        en_01S00,
+        en_01S01,
+        en_01S02,
+        en_01S03,
+        en_01S04,
+        en_07001,
+        en_07006,
+        en_08001,
+        en_08002,
+        en_08003,
+        en_08004,
+        en_08007,
+        en_08S01,
+        en_21S01,
+        en_21S02,
+        en_22001,
+        en_22003,
+        en_22005,
+        en_22008,
+        en_22012,
+        en_22026,
+        en_23000,
+        en_24000,
+        en_25000,
+        en_28000,
+        en_34000,
+        en_37000,
+        en_3C000,
+        en_40001,
+        en_42000,
+        en_70100,
+        en_IM001,
+        en_IM002,
+        en_IM003,
+        en_IM004,
+        en_IM005,
+        en_IM006,
+        en_IM007,
+        en_IM008,
+        en_IM009,
+        en_IM010,
+        en_IM011,
+        en_IM012,
+        en_IM013,
+        en_IM014,
+        en_S0001,
+        en_S0002,
+        en_S0011,
+        en_S0012,
+        en_S0021,
+        en_S0022,
+        en_S0023,
+        en_S1000,
+        en_S1001,
+        en_S1002,
+        en_S1003,
+        en_S1004,
+        en_S1008,
+        en_S1009,
+        en_S1010,
+        en_S1011,
+        en_S1012,
+        en_S1015,
+        en_S1090,
+        en_S1091,
+        en_S1092,
+        en_S1093,
+        en_S1094,
+        en_S1095,
+        en_S1096,
+        en_S1097,
+        en_S1098,
+        en_S1099,
+        en_S1100,
+        en_S1101,
+        en_S1103,
+        en_S1104,
+        en_S1105,
+        en_S1106,
+        en_S1107,
+        en_S1108,
+        en_S1109,
+        en_S1110,
+        en_S1111,
+        en_S1C00,
+        en_S1T00,
+        en_sqlstat_total
 } sqlstcode_t;
 
-typedef        void FAR*       HERR;
-# define SQL_NULL_HERR ((HERR)NULL)
+typedef void FAR*       HERR;
+# define SQL_NULL_HERR  ((HERR)NULL)
 
 typedef struct
 {
-       sqlstcode_t     code;
-       char FAR*       stat;
-       char FAR*       msg;
+        sqlstcode_t     code;
+        char FAR*       stat;
+        char FAR*       msg;
 } sqlerrmsg_t;
 
-typedef        struct sqlerr {
-       sqlstcode_t     code;
-       int             idx;
-       char FAR*       msg;
-       struct sqlerr*  next;   
+typedef struct sqlerr {
+        sqlstcode_t     code;
+        int             idx;
+        char FAR*       msg;
+        struct sqlerr*  next;
 } sqlerr_t;
 
-extern void            _iodbcdm_freesqlerrlist( HERR herr );
-extern HERR            _iodbcdm_pushsqlerr ( HERR list, sqlstcode_t code, char* sysmsg );
+extern void             _iodbcdm_freesqlerrlist( HERR herr );
+extern HERR             _iodbcdm_pushsqlerr ( HERR list, sqlstcode_t code, char* sysmsg );
 
-# define       PUSHSYSERR(list, msg)   \
-                       list = (HERR)_iodbcdm_pushsqlerr( (HERR)(list), 0, (char*)msg ) 
-# define       PUSHSQLERR(list, code)  \
-                       list = (HERR)_iodbcdm_pushsqlerr( (HERR)(list), (int)(code), NULL ) 
-                                               
+# define        PUSHSYSERR(list, msg)   \
+                        list = (HERR)_iodbcdm_pushsqlerr( (HERR)(list), 0, (char*)msg )
+# define        PUSHSQLERR(list, code)  \
+                        list = (HERR)_iodbcdm_pushsqlerr( (HERR)(list), (int)(code), NULL )
 
-#endif /* _SQLERR_H */
+
+#endif  /* _SQLERR_H */
index 0aec8ef807ce17734655693394fb96ab84c82b70..425fe8b2e299b48d096f6e25aef4fcf6b49310e8 100644 (file)
@@ -1,6 +1,6 @@
 /** Query statement object management functions
-       
-    Copyright (C) 1995 by Ke Jin <kejin@empress.com> 
+
+    Copyright (C) 1995 by Ke Jin <kejin@empress.com>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 
 #include       <../iodbc/itrace.h>
 
-RETCODE SQL_API        SQLAllocStmt (
-                       HDBC            hdbc,
-                       HSTMT FAR*      phstmt )
+RETCODE SQL_API SQLAllocStmt (
+                        HDBC            hdbc,
+                        HSTMT FAR*      phstmt )
 {
-       DBC_t  FAR*     pdbc    = (DBC_t FAR*)hdbc;
-       STMT_t FAR*     pstmt   = NULL;
-       HPROC           hproc   = SQL_NULL_HPROC;
-       RETCODE         retcode = SQL_SUCCESS;
+        DBC_t  FAR*     pdbc    = (DBC_t FAR*)hdbc;
+        STMT_t FAR*     pstmt   = NULL;
+        HPROC           hproc   = SQL_NULL_HPROC;
+        RETCODE         retcode = SQL_SUCCESS;
 
 #if (ODBCVER >= 0x0300)
-       if( hdbc == SQL_NULL_HDBC 
-        || pdbc->type != SQL_HANDLE_DBC )
+        if( hdbc == SQL_NULL_HDBC
+         || pdbc->type != SQL_HANDLE_DBC )
 #else
-       if( hdbc == SQL_NULL_HDBC )
+        if( hdbc == SQL_NULL_HDBC )
 #endif
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       if( phstmt == NULL )
-       {
-               PUSHSQLERR ( pdbc->herr, en_S1009 );
-
-               return SQL_ERROR;
-       }
-
-       /* check state */
-       switch( pdbc->state )
-       {
-               case en_dbc_connected:
-               case en_dbc_hstmt:
-                       break;
-
-               case en_dbc_allocated:
-               case en_dbc_needdata:
-                       PUSHSQLERR ( pdbc->herr, en_08003 );
-                       *phstmt = SQL_NULL_HSTMT;
-                       return SQL_ERROR;
-
-               default:
-                       return SQL_INVALID_HANDLE;
-       }
-
-       pstmt = (STMT_t FAR*)MEM_ALLOC(sizeof(STMT_t));
-
-       if( pstmt == NULL )
-       {
-               PUSHSQLERR ( pdbc->herr, en_S1001 );
-               *phstmt = SQL_NULL_HSTMT;
-               
-               return SQL_ERROR;
-       }
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        if( phstmt == NULL )
+        {
+                PUSHSQLERR ( pdbc->herr, en_S1009 );
+
+                return SQL_ERROR;
+        }
+
+        /* check state */
+        switch( pdbc->state )
+        {
+                case en_dbc_connected:
+                case en_dbc_hstmt:
+                        break;
+
+                case en_dbc_allocated:
+                case en_dbc_needdata:
+                        PUSHSQLERR ( pdbc->herr, en_08003 );
+                        *phstmt = SQL_NULL_HSTMT;
+                        return SQL_ERROR;
+
+                default:
+                        return SQL_INVALID_HANDLE;
+        }
+
+        pstmt = (STMT_t FAR*)MEM_ALLOC(sizeof(STMT_t));
+
+        if( pstmt == NULL )
+        {
+                PUSHSQLERR ( pdbc->herr, en_S1001 );
+                *phstmt = SQL_NULL_HSTMT;
+
+                return SQL_ERROR;
+        }
 
 #if (ODBCVER >= 0x0300)
-       pstmt->type = SQL_HANDLE_STMT;
+        pstmt->type = SQL_HANDLE_STMT;
 #endif
-       /* initiate the object */
-       pstmt->herr = SQL_NULL_HERR;
-       pstmt->hdbc = hdbc;
-       pstmt->state = en_stmt_allocated;
-       pstmt->cursor_state = en_stmt_cursor_no;
-       pstmt->prep_state = 0;
-       pstmt->asyn_on = en_NullProc;   
-       pstmt->need_on = en_NullProc;
-
-       /* call driver's function */
+        /* initiate the object */
+        pstmt->herr = SQL_NULL_HERR;
+        pstmt->hdbc = hdbc;
+        pstmt->state = en_stmt_allocated;
+        pstmt->cursor_state = en_stmt_cursor_no;
+        pstmt->prep_state = 0;
+        pstmt->asyn_on = en_NullProc;
+        pstmt->need_on = en_NullProc;
+
+        /* call driver's function */
 #if (ODBCVER >= 0x0300)
-       hproc = _iodbcdm_getproc( hdbc, en_AllocHandle );
-
-       if( hproc )
-       {
-               CALL_DRIVER ( pstmt->hdbc, hdbc, retcode, hproc, 
-                       en_AllocHandle, ( 
-                       SQL_HANDLE_STMT, 
-                       pdbc->dhdbc, 
-                       &(pstmt->dhstmt) ) )
-       }
-       else
+        hproc = _iodbcdm_getproc( hdbc, en_AllocHandle );
+
+        if( hproc )
+        {
+                CALL_DRIVER ( pstmt->hdbc, hdbc, retcode, hproc,
+                        en_AllocHandle, (
+                        SQL_HANDLE_STMT,
+                        pdbc->dhdbc,
+                        &(pstmt->dhstmt) ) )
+        }
+        else
 #endif
-       {
-               hproc = _iodbcdm_getproc( hdbc, en_AllocStmt );
+        {
+                hproc = _iodbcdm_getproc( hdbc, en_AllocStmt );
 
-               if( hproc == SQL_NULL_HPROC )
-               {
-                       PUSHSQLERR ( pstmt->herr, en_IM001 );
-                       *phstmt = SQL_NULL_HSTMT;
-                       MEM_FREE ( pstmt );
+                if( hproc == SQL_NULL_HPROC )
+                {
+                        PUSHSQLERR ( pstmt->herr, en_IM001 );
+                        *phstmt = SQL_NULL_HSTMT;
+                        MEM_FREE ( pstmt );
 
-                       return SQL_ERROR;
-               }
+                        return SQL_ERROR;
+                }
 
-               CALL_DRIVER ( hdbc, retcode, hproc, en_AllocStmt, (
-                               pdbc->dhdbc, &(pstmt->dhstmt) ) )
-       }
+                CALL_DRIVER ( hdbc, retcode, hproc, en_AllocStmt, (
+                                pdbc->dhdbc, &(pstmt->dhstmt) ) )
+        }
 
-       if( retcode != SQL_SUCCESS 
-        && retcode != SQL_SUCCESS_WITH_INFO )
-       {
-               *phstmt = SQL_NULL_HSTMT;
-               MEM_FREE ( pstmt );
+        if( retcode != SQL_SUCCESS
+         && retcode != SQL_SUCCESS_WITH_INFO )
+        {
+                *phstmt = SQL_NULL_HSTMT;
+                MEM_FREE ( pstmt );
 
-               return retcode;
-       }
+                return retcode;
+        }
 
-       /* insert into list */
-       pstmt->next = pdbc->hstmt;
-       pdbc->hstmt = pstmt;
+        /* insert into list */
+        pstmt->next = pdbc->hstmt;
+        pdbc->hstmt = pstmt;
 
-       *phstmt = (HSTMT)pstmt;
+        *phstmt = (HSTMT)pstmt;
 
-       /* state transition */
-       pdbc->state = en_dbc_hstmt;     
+        /* state transition */
+        pdbc->state = en_dbc_hstmt;
 
-       return SQL_SUCCESS;
+        return SQL_SUCCESS;
 }
 
 RETCODE _iodbcdm_dropstmt( HSTMT hstmt )
 {
-       STMT_t FAR*     pstmt = (STMT_t FAR*)hstmt;
-       STMT_t FAR*     tpstmt;
-       DBC_t  FAR*     pdbc;
-
-       if( hstmt == SQL_NULL_HSTMT )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       pdbc = (DBC_t FAR*)(pstmt->hdbc);
-
-       for(tpstmt  = (STMT_t FAR*)pdbc->hstmt;
-           tpstmt != NULL;
-           tpstmt  = tpstmt->next )
-       {
-               if(tpstmt == pstmt)
-               {
-                       pdbc->hstmt = (HSTMT)pstmt->next;
-                       break;
-               }
-
-               if(tpstmt->next == pstmt)
-               {
-                       tpstmt->next = pstmt->next;
-                       break;
-               }
-       }
-
-       if( tpstmt == NULL )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-                       
-       _iodbcdm_freesqlerrlist(pstmt->herr);
-       MEM_FREE(hstmt);
-
-       return SQL_SUCCESS;
+        STMT_t FAR*     pstmt = (STMT_t FAR*)hstmt;
+        STMT_t FAR*     tpstmt;
+        DBC_t  FAR*     pdbc;
+
+        if( hstmt == SQL_NULL_HSTMT )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        pdbc = (DBC_t FAR*)(pstmt->hdbc);
+
+        for(tpstmt  = (STMT_t FAR*)pdbc->hstmt;
+            tpstmt != NULL;
+            tpstmt  = tpstmt->next )
+        {
+                if(tpstmt == pstmt)
+                {
+                        pdbc->hstmt = (HSTMT)pstmt->next;
+                        break;
+                }
+
+                if(tpstmt->next == pstmt)
+                {
+                        tpstmt->next = pstmt->next;
+                        break;
+                }
+        }
+
+        if( tpstmt == NULL )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        _iodbcdm_freesqlerrlist(pstmt->herr);
+        MEM_FREE(hstmt);
+
+        return SQL_SUCCESS;
 }
 
-RETCODE SQL_API        SQLFreeStmt (
-                       HSTMT   hstmt,
-                       UWORD   fOption )
+RETCODE SQL_API SQLFreeStmt (
+                        HSTMT   hstmt,
+                        UWORD   fOption )
 {
-       STMT_t FAR*     pstmt = (STMT_t FAR*)hstmt;
-/*     STMT_t FAR*     tpstmt; */
-       DBC_t  FAR*     pdbc;
-
-       HPROC           hproc = SQL_NULL_HPROC;
-       RETCODE         retcode;
-
-       if( hstmt == SQL_NULL_HSTMT 
-        || pstmt->hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       pdbc = (DBC_t FAR*)(pstmt->hdbc);
-
-       /* check option */ 
-       switch( fOption )
-       {
-               case SQL_DROP:
-               case SQL_CLOSE:
-               case SQL_UNBIND:
-               case SQL_RESET_PARAMS:
-                       break;
-
-               default:
-                       PUSHSQLERR ( pstmt->herr, en_S1092 );
-                       return SQL_ERROR;
-       }
-
-       /* check state */
-       if( pstmt->state >= en_stmt_needdata 
-        || pstmt->asyn_on != en_NullProc )
-       {
-               PUSHSQLERR ( pstmt->herr, en_S1010 );
-
-               return SQL_ERROR;
-       }
-
-       hproc = SQL_NULL_HPROC;
+        STMT_t FAR*     pstmt = (STMT_t FAR*)hstmt;
+        STMT_t FAR*     tpstmt;
+        DBC_t  FAR*     pdbc;
+
+        HPROC           hproc = SQL_NULL_HPROC;
+        RETCODE         retcode;
+
+        if( hstmt == SQL_NULL_HSTMT
+         || pstmt->hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        pdbc = (DBC_t FAR*)(pstmt->hdbc);
+
+        /* check option */
+        switch( fOption )
+        {
+                case SQL_DROP:
+                case SQL_CLOSE:
+                case SQL_UNBIND:
+                case SQL_RESET_PARAMS:
+                        break;
+
+                default:
+                        PUSHSQLERR ( pstmt->herr, en_S1092 );
+                        return SQL_ERROR;
+        }
+
+        /* check state */
+        if( pstmt->state >= en_stmt_needdata
+         || pstmt->asyn_on != en_NullProc )
+        {
+                PUSHSQLERR ( pstmt->herr, en_S1010 );
+
+                return SQL_ERROR;
+        }
+
+        hproc == SQL_NULL_HPROC;
 
 #if (ODBCVER >= 0x0300)
-       if( fOption == SQL_DROP )
-       {
-               hproc = _iodbcdm_getproc( pstmt->hdbc, en_FreeHandle );
-       
-               if( hproc )
-               {
-                       CALL_DRIVER( pstmt->hdbc, retcode, hproc, en_FreeHandle, (
-                               SQL_HANDLE_STMT, pstmt->dhstmt ) 
-               }
-       }
+        if( fOption == SQL_DROP )
+        {
+                hproc = _iodbcdm_getproc( pstmt->hdbc, en_FreeHandle );
+
+                if( hproc )
+                {
+                        CALL_DRIVER( pstmt->hdbc, retcode, hproc, en_FreeHandle, (
+                                SQL_HANDLE_STMT, pstmt->dhstmt )
+                }
+        }
 #endif
 
-       if( hproc == SQL_NULL_HPROC )
-       {
-               hproc = _iodbcdm_getproc( pstmt->hdbc, en_FreeStmt);
-
-               if( hproc == SQL_NULL_HPROC )
-               {
-                       PUSHSQLERR ( pstmt->herr, en_IM001 );
-
-                       return SQL_ERROR;
-               }
-
-               CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_FreeStmt, (
-                               pstmt->dhstmt, fOption) )
-       }
-
-       if( retcode != SQL_SUCCESS 
-        && retcode != SQL_SUCCESS_WITH_INFO )
-       {
-               return retcode;
-       }
-
-       /* state transition */
-       switch( fOption )
-       {
-               case SQL_DROP:
-                       /* delet this object (ignore return) */
-                       _iodbcdm_dropstmt( hstmt );
-                       break;
-
-               case SQL_CLOSE:
-                       pstmt->cursor_state = en_stmt_cursor_no;
-                       /* This means cursor name set by
-                        * SQLSetCursorName() call will also 
-                        * be erased.
-                        */
-
-                       switch( pstmt->state )
-                       {
-                               case en_stmt_allocated:
-                               case en_stmt_prepared:
-                                       break;
-
-                               case en_stmt_executed:
-                               case en_stmt_cursoropen:
-                               case en_stmt_fetched:
-                               case en_stmt_xfetched:
-                                       if( pstmt->prep_state )
-                                       {
-                                               pstmt->state =
-                                               en_stmt_prepared;
-                                       }
-                                       else
-                                       {
-                                               pstmt->state =
-                                               en_stmt_allocated;
-                                       }
-                                       break;
-
-                               default:
-                                       break;
-                       }
-                       break;
-
-               case SQL_UNBIND:
-               case SQL_RESET_PARAMS:
-               default:
-                       break;
-       }
-
-       return retcode;
+        if( hproc == SQL_NULL_HPROC )
+        {
+                hproc = _iodbcdm_getproc( pstmt->hdbc, en_FreeStmt);
+
+                if( hproc == SQL_NULL_HPROC )
+                {
+                        PUSHSQLERR ( pstmt->herr, en_IM001 );
+
+                        return SQL_ERROR;
+                }
+
+                CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_FreeStmt, (
+                                pstmt->dhstmt, fOption) )
+        }
+
+        if( retcode != SQL_SUCCESS
+         && retcode != SQL_SUCCESS_WITH_INFO )
+        {
+                return retcode;
+        }
+
+        /* state transition */
+        switch( fOption )
+        {
+                case SQL_DROP:
+                        /* delet this object (ignore return) */
+                        _iodbcdm_dropstmt( hstmt );
+                        break;
+
+                case SQL_CLOSE:
+                        pstmt->cursor_state = en_stmt_cursor_no;
+                        /* This means cursor name set by
+                         * SQLSetCursorName() call will also
+                         * be erased.
+                         */
+
+                        switch( pstmt->state )
+                        {
+                                case en_stmt_allocated:
+                                case en_stmt_prepared:
+                                        break;
+
+                                case en_stmt_executed:
+                                case en_stmt_cursoropen:
+                                case en_stmt_fetched:
+                                case en_stmt_xfetched:
+                                        if( pstmt->prep_state )
+                                        {
+                                                pstmt->state =
+                                                en_stmt_prepared;
+                                        }
+                                        else
+                                        {
+                                                pstmt->state =
+                                                en_stmt_allocated;
+                                        }
+                                        break;
+
+                                default:
+                                        break;
+                        }
+                        break;
+
+                case SQL_UNBIND:
+                case SQL_RESET_PARAMS:
+                default:
+                        break;
+        }
+
+        return retcode;
 }
 
-RETCODE SQL_API        SQLSetStmtOption (
-                       HSTMT   hstmt,
-                       UWORD   fOption,
-                       UDWORD  vParam )
+RETCODE SQL_API SQLSetStmtOption (
+                        HSTMT   hstmt,
+                        UWORD   fOption,
+                        UDWORD  vParam )
 {
-       STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
-       HPROC           hproc;
-       int             sqlstat = en_00000;
-       RETCODE         retcode;
-       
-       if( hstmt == SQL_NULL_HSTMT 
-        || pstmt->hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       /* check option */
-       if(/* fOption < SQL_STMT_OPT_MIN || */
-             fOption > SQL_STMT_OPT_MAX )
-       {
-               PUSHSQLERR ( pstmt->herr, en_S1092 );
-
-               return SQL_ERROR;
-       }
-
-       if( fOption == SQL_CONCURRENCY 
-        || fOption == SQL_CURSOR_TYPE 
-        || fOption == SQL_SIMULATE_CURSOR 
-        || fOption == SQL_USE_BOOKMARKS )
-       {
-               if( pstmt->asyn_on != en_NullProc )
-               {
-                       if( pstmt->prep_state )
-                       {
-                               sqlstat = en_S1011;
-                       }
-               }
-               else
-               {
-                       switch( pstmt->state )
-                       {
-                               case en_stmt_prepared:
-                                       sqlstat = en_S1011;
-                                       break;
-       
-                               case en_stmt_executed:
-                               case en_stmt_cursoropen:
-                               case en_stmt_fetched:
-                               case en_stmt_xfetched:
-                                       sqlstat = en_24000;
-                                       break;
-       
-                               case en_stmt_needdata:
-                               case en_stmt_mustput:
-                               case en_stmt_canput:
-                                       if( pstmt->prep_state )
-                                       {
-                                               sqlstat = en_S1011;
-                                       }
-                                       break;
-                               
-                               default:
-                                       break;
-                       }
-               }
-       }
-       else
-       {
-               if( pstmt->asyn_on != en_NullProc )
-               {
-                       if( ! pstmt->prep_state )
-                       {
-                               sqlstat = en_S1010;
-                       }
-               }
-               else
-               {
-                       if( pstmt->state >= en_stmt_needdata )
-                       {
-                               sqlstat = en_S1010;
-                       }
-               }
-       }
-
-       if( sqlstat != en_00000 )
-       {
-               PUSHSQLERR ( pstmt->herr, sqlstat );
-
-               return SQL_ERROR;
-       }
-
-       hproc = _iodbcdm_getproc( pstmt->hdbc, en_SetStmtOption );
-
-       if( hproc == SQL_NULL_HPROC )
-       {
-               PUSHSQLERR ( pstmt->herr, en_IM001 );
-
-               return SQL_ERROR;
-       }
-
-       CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_SetStmtOption, (
-                       pstmt->dhstmt, fOption, vParam ) )
+        STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
+        HPROC           hproc;
+        int             sqlstat = en_00000;
+        RETCODE         retcode;
+
+        if( hstmt == SQL_NULL_HSTMT
+         || pstmt->hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        /* check option */
+        if(/* fOption < SQL_STMT_OPT_MIN || */
+              fOption > SQL_STMT_OPT_MAX )
+        {
+                PUSHSQLERR ( pstmt->herr, en_S1092 );
+
+                return SQL_ERROR;
+        }
+
+        if( fOption == SQL_CONCURRENCY
+         || fOption == SQL_CURSOR_TYPE
+         || fOption == SQL_SIMULATE_CURSOR
+         || fOption == SQL_USE_BOOKMARKS )
+        {
+                if( pstmt->asyn_on != en_NullProc )
+                {
+                        if( pstmt->prep_state )
+                        {
+                                sqlstat = en_S1011;
+                        }
+                }
+                else
+                {
+                        switch( pstmt->state )
+                        {
+                                case en_stmt_prepared:
+                                        sqlstat = en_S1011;
+                                        break;
+
+                                case en_stmt_executed:
+                                case en_stmt_cursoropen:
+                                case en_stmt_fetched:
+                                case en_stmt_xfetched:
+                                        sqlstat = en_24000;
+                                        break;
+
+                                case en_stmt_needdata:
+                                case en_stmt_mustput:
+                                case en_stmt_canput:
+                                        if( pstmt->prep_state )
+                                        {
+                                                sqlstat = en_S1011;
+                                        }
+                                        break;
+
+                                default:
+                                        break;
+                        }
+                }
+        }
+        else
+        {
+                if( pstmt->asyn_on != en_NullProc )
+                {
+                        if( ! pstmt->prep_state )
+                        {
+                                sqlstat = en_S1010;
+                        }
+                }
+                else
+                {
+                        if( pstmt->state >= en_stmt_needdata )
+                        {
+                                sqlstat = en_S1010;
+                        }
+                }
+        }
+
+        if( sqlstat != en_00000 )
+        {
+                PUSHSQLERR ( pstmt->herr, sqlstat );
+
+                return SQL_ERROR;
+        }
+
+        hproc = _iodbcdm_getproc( pstmt->hdbc, en_SetStmtOption );
+
+        if( hproc == SQL_NULL_HPROC )
+        {
+                PUSHSQLERR ( pstmt->herr, en_IM001 );
+
+                return SQL_ERROR;
+        }
+
+        CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_SetStmtOption, (
+                        pstmt->dhstmt, fOption, vParam ) )
 
 #if 0
-       retcode = hproc ( pstmt->dhstmt, fOption, vParam );
+        retcode = hproc ( pstmt->dhstmt, fOption, vParam );
 #endif
 
-       return retcode;
+        return retcode;
 }
 
-RETCODE SQL_API        SQLGetStmtOption (
-                       HSTMT   hstmt,
-                       UWORD   fOption,
-                       PTR     pvParam )
+RETCODE SQL_API SQLGetStmtOption (
+                        HSTMT   hstmt,
+                        UWORD   fOption,
+                        PTR     pvParam )
 {
-       STMT_t FAR*     pstmt   = (STMT_t*)hstmt;
-       HPROC           hproc;
-       int             sqlstat = en_00000;
-       RETCODE         retcode;
-
-       if( hstmt == SQL_NULL_HSTMT 
-        || pstmt->hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       /* check option */
-       if( /* fOption < SQL_STMT_OPT_MIN || */
-              fOption > SQL_STMT_OPT_MAX )
-       {
-               PUSHSQLERR ( pstmt->herr, en_S1092 );
-
-               return SQL_ERROR;
-       }
-
-       /* check state */
-       if( pstmt->state >= en_stmt_needdata
-        || pstmt->asyn_on != en_NullProc )
-       {
-               sqlstat = en_S1010;
-       }
-       else
-       {
-               switch( pstmt->state )
-               {
-                       case en_stmt_allocated:
-                       case en_stmt_prepared:
-                       case en_stmt_executed:
-                       case en_stmt_cursoropen:
-                               if( fOption == SQL_ROW_NUMBER
-                                || fOption == SQL_GET_BOOKMARK )
-                               {
-                                       sqlstat = en_24000;
-                               }
-                               break;
-
-                       default:
-                               break;
-               }
-       }
-
-       if( sqlstat != en_00000 )
-       {
-               PUSHSQLERR ( pstmt->herr, sqlstat );
-
-               return SQL_ERROR;
-       }
-
-       hproc = _iodbcdm_getproc( pstmt->hdbc, en_GetStmtOption);
-
-       if( hproc == SQL_NULL_HPROC )
-       {
-               PUSHSQLERR ( pstmt->herr, en_IM001 );
-               return SQL_ERROR;
-       }
-
-       CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_GetStmtOption, (
-                       pstmt->dhstmt, fOption, pvParam ) )
+        STMT_t FAR*     pstmt   = (STMT_t*)hstmt;
+        HPROC           hproc;
+        int             sqlstat = en_00000;
+        RETCODE         retcode;
+
+        if( hstmt == SQL_NULL_HSTMT
+         || pstmt->hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        /* check option */
+        if( /* fOption < SQL_STMT_OPT_MIN || */
+               fOption > SQL_STMT_OPT_MAX )
+        {
+                PUSHSQLERR ( pstmt->herr, en_S1092 );
+
+                return SQL_ERROR;
+        }
+
+        /* check state */
+        if( pstmt->state >= en_stmt_needdata
+         || pstmt->asyn_on != en_NullProc )
+        {
+                sqlstat = en_S1010;
+        }
+        else
+        {
+                switch( pstmt->state )
+                {
+                        case en_stmt_allocated:
+                        case en_stmt_prepared:
+                        case en_stmt_executed:
+                        case en_stmt_cursoropen:
+                                if( fOption == SQL_ROW_NUMBER
+                                 || fOption == SQL_GET_BOOKMARK )
+                                {
+                                        sqlstat = en_24000;
+                                }
+                                break;
+
+                        default:
+                                break;
+                }
+        }
+
+        if( sqlstat != en_00000 )
+        {
+                PUSHSQLERR ( pstmt->herr, sqlstat );
+
+                return SQL_ERROR;
+        }
+
+        hproc = _iodbcdm_getproc( pstmt->hdbc, en_GetStmtOption);
+
+        if( hproc == SQL_NULL_HPROC )
+        {
+                PUSHSQLERR ( pstmt->herr, en_IM001 );
+                return SQL_ERROR;
+        }
+
+        CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_GetStmtOption, (
+                        pstmt->dhstmt, fOption, pvParam ) )
 
 #if 0
-       retcode = hproc ( pstmt->dhstmt, fOption, pvParam );
+        retcode = hproc ( pstmt->dhstmt, fOption, pvParam );
 #endif
-       
-       return retcode;
+
+        return retcode;
 }
 
-RETCODE SQL_API        SQLCancel ( HSTMT hstmt )
+RETCODE SQL_API SQLCancel ( HSTMT hstmt )
 {
-       STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
-       HPROC           hproc;
-       RETCODE         retcode;
+        STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
+        HPROC           hproc;
+        RETCODE         retcode;
 
-       if( hstmt == SQL_NULL_HSTMT 
-        || pstmt->hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
+        if( hstmt == SQL_NULL_HSTMT
+         || pstmt->hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
 
-       /* check argument */
-       /* check state */
+        /* check argument */
+        /* check state */
 
-       /* call driver */
-       hproc = _iodbcdm_getproc( pstmt->hdbc, en_Cancel );
+        /* call driver */
+        hproc = _iodbcdm_getproc( pstmt->hdbc, en_Cancel );
 
-       if( hproc == SQL_NULL_HPROC )
-       {
-               PUSHSQLERR ( pstmt->herr, en_IM001 );
+        if( hproc == SQL_NULL_HPROC )
+        {
+                PUSHSQLERR ( pstmt->herr, en_IM001 );
 
-               return SQL_ERROR;
-       }
+                return SQL_ERROR;
+        }
 
-       CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_Cancel, (pstmt->dhstmt) )
+        CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_Cancel, (pstmt->dhstmt) )
 
 #if 0
-       retcode = hproc ( pstmt->dhstmt );
+        retcode = hproc ( pstmt->dhstmt );
 #endif
 
-       /* state transition */
-       if( retcode != SQL_SUCCESS
-        && retcode != SQL_SUCCESS_WITH_INFO )
-       {
-               return retcode;
-       }
-
-       switch( pstmt->state )
-       {
-               case en_stmt_allocated:
-               case en_stmt_prepared:
-                       break;
-
-               case en_stmt_executed:
-                       if( pstmt->prep_state )
-                       {
-                               pstmt->state = en_stmt_prepared;
-                       }
-                       else
-                       {
-                               pstmt->state = en_stmt_allocated;
-                       }
-                       break;
-
-               case en_stmt_cursoropen:
-               case en_stmt_fetched:
-               case en_stmt_xfetched:
-                       if( pstmt->prep_state )
-                       {
-                               pstmt->state = en_stmt_prepared;
-                       }
-                       else
-                       {
-                               pstmt->state = en_stmt_allocated;
-                       }
-                       break;
-
-               case en_stmt_needdata:
-               case en_stmt_mustput:
-               case en_stmt_canput:
-                       switch( pstmt->need_on )
-                       {
-                               case en_ExecDirect:
-                                       pstmt->state = en_stmt_allocated;
-                                       break;
-
-                               case en_Execute:
-                                       pstmt->state = en_stmt_prepared;
-                                       break;
-
-                               case en_SetPos:
-                                       pstmt->state = en_stmt_xfetched;
-                                       break;
-
-                               default:
-                                       break;
-                       }
-                       pstmt->need_on = en_NullProc;
-                       break;
-
-               default:
-                       break;
-       }
-
-       return retcode;
+        /* state transition */
+        if( retcode != SQL_SUCCESS
+         && retcode != SQL_SUCCESS_WITH_INFO )
+        {
+                return retcode;
+        }
+
+        switch( pstmt->state )
+        {
+                case en_stmt_allocated:
+                case en_stmt_prepared:
+                        break;
+
+                case en_stmt_executed:
+                        if( pstmt->prep_state )
+                        {
+                                pstmt->state = en_stmt_prepared;
+                        }
+                        else
+                        {
+                                pstmt->state = en_stmt_allocated;
+                        }
+                        break;
+
+                case en_stmt_cursoropen:
+                case en_stmt_fetched:
+                case en_stmt_xfetched:
+                        if( pstmt->prep_state )
+                        {
+                                pstmt->state = en_stmt_prepared;
+                        }
+                        else
+                        {
+                                pstmt->state = en_stmt_allocated;
+                        }
+                        break;
+
+                case en_stmt_needdata:
+                case en_stmt_mustput:
+                case en_stmt_canput:
+                        switch( pstmt->need_on )
+                        {
+                                case en_ExecDirect:
+                                        pstmt->state = en_stmt_allocated;
+                                        break;
+
+                                case en_Execute:
+                                        pstmt->state = en_stmt_prepared;
+                                        break;
+
+                                case en_SetPos:
+                                        pstmt->state = en_stmt_xfetched;
+                                        break;
+
+                                default:
+                                        break;
+                        }
+                        pstmt->need_on = en_NullProc;
+                        break;
+
+                default:
+                        break;
+        }
+
+        return retcode;
 }
index 68403e46031bfcf1654e6cfd9620fab4bcfb7c1c..99e826e5fa3aec951e1280431cc718248892a8b4 100644 (file)
@@ -1,48 +1,48 @@
-#ifndef        _HSTMT_H
-#define        _HSTMT_H
+#ifndef _HSTMT_H
+#define _HSTMT_H
 
-#include       <../iodbc/config.h>
+#include        <config.h>
 
-#include       <../iodbc/isql.h>
-#include       <../iodbc/isqlext.h>
+#include        <isql.h>
+#include        <isqlext.h>
 
-typedef        struct STMT
+typedef struct STMT
 {
-       int     type;           /* must be 1st field */
+        int     type;           /* must be 1st field */
 
-       struct STMT*  next;
+        struct STMT*  next;
 
-       HERR    herr;
-       HDBC    hdbc;           /* back point to connection object */
-       HSTMT   dhstmt;         /* driver's stmt handle */
+        HERR    herr;
+        HDBC    hdbc;           /* back point to connection object */
+        HSTMT   dhstmt;         /* driver's stmt handle */
 
-       int     state;
-       int     cursor_state;
-       int     prep_state;      
-       int     asyn_on;        /* async executing which odbc call */
-       int     need_on;        /* which call return SQL_NEED_DATA */
+        int     state;
+        int     cursor_state;
+        int     prep_state;
+        int     asyn_on;        /* async executing which odbc call */
+        int     need_on;        /* which call return SQL_NEED_DATA */
 } STMT_t;
 
-enum   {
-       en_stmt_allocated = 0,
-       en_stmt_prepared,
-       en_stmt_executed, 
-       en_stmt_cursoropen,
-       en_stmt_fetched,
-       en_stmt_xfetched,
-       en_stmt_needdata,       /* not call SQLParamData() yet */
-       en_stmt_mustput,        /* not call SQLPutData() yet */
-       en_stmt_canput  /* SQLPutData() called */
-};     /* for statement handle state */
-
-enum   {
-       en_stmt_cursor_no = 0,
-       en_stmt_cursor_named,
-       en_stmt_cursor_opened,
-       en_stmt_cursor_fetched,
-       en_stmt_cursor_xfetched
-};     /* for statement cursor state */
-
-extern RETCODE _iodbcdm_dropstmt();
+enum    {
+        en_stmt_allocated = 0,
+        en_stmt_prepared,
+        en_stmt_executed,
+        en_stmt_cursoropen,
+        en_stmt_fetched,
+        en_stmt_xfetched,
+        en_stmt_needdata,       /* not call SQLParamData() yet */
+        en_stmt_mustput,        /* not call SQLPutData() yet */
+        en_stmt_canput  /* SQLPutData() called */
+};      /* for statement handle state */
+
+enum    {
+        en_stmt_cursor_no = 0,
+        en_stmt_cursor_named,
+        en_stmt_cursor_opened,
+        en_stmt_cursor_fetched,
+        en_stmt_cursor_xfetched
+};      /* for statement cursor state */
+
+extern  RETCODE _iodbcdm_dropstmt();
 
 #endif
index 600bcc6a3a7f03061ecc05160a7c3c7a0b80fd94..34bfdeec6418d656df148896101086d6bb19f54b 100644 (file)
@@ -1,6 +1,6 @@
 /** Information functions
-    Copyright (C) 1995 by Ke Jin <kejin@empress.com> 
+
+    Copyright (C) 1995 by Ke Jin <kejin@empress.com>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 #include        <strings.h>
 #include        <stdio.h>
 
-RETCODE SQL_API        SQLDataSources( 
-                       HENV            henv,
-                       UWORD           fDir,
-                       UCHAR  FAR*     szDSN,
-                       SWORD           cbDSNMax,
-                       SWORD  FAR*     pcbDSN,
-                       UCHAR  FAR*     szDesc,
-                       SWORD           cbDescMax,
-                       SWORD  FAR*     pcbDesc )
+RETCODE SQL_API SQLDataSources(
+                        HENV            henv,
+                        UWORD           fDir,
+                        UCHAR  FAR*     szDSN,
+                        SWORD           cbDSNMax,
+                        SWORD  FAR*     pcbDSN,
+                        UCHAR  FAR*     szDesc,
+                        SWORD           cbDescMax,
+                        SWORD  FAR*     pcbDesc )
 {
-       GENV_t FAR*     genv    = (GENV_t FAR*)henv;
-       
-       if( henv == SQL_NULL_HENV )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       /* check argument */
-       if( cbDSNMax < 0 || cbDescMax < 0 )
-       {
-               PUSHSQLERR ( genv->herr, en_S1090 );
-               
-               return SQL_ERROR;
-       }
-
-       if( fDir != SQL_FETCH_FIRST
-        && fDir != SQL_FETCH_NEXT )
-       {
-               PUSHSQLERR ( genv->herr, en_S1103 );
-
-               return SQL_ERROR;
-       }
-
-       /*************************/
-
-       return SQL_NO_DATA_FOUND;
-} 
-
-RETCODE SQL_API        SQLDrivers(
-                       HENV            henv,
-                       UWORD           fDir,
-                       UCHAR  FAR*     szDrvDesc,
-                       SWORD           cbDrvDescMax,
-                       SWORD  FAR*     pcbDrvDesc,
-                       UCHAR  FAR*     szDrvAttr,
-                       SWORD           cbDrvAttrMax,
-                       SWORD  FAR*     pcbDrvAttr )
+        GENV_t FAR*     genv    = (GENV_t FAR*)henv;
+
+        if( henv == SQL_NULL_HENV )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        /* check argument */
+        if( cbDSNMax < 0 || cbDescMax < 0 )
+        {
+                PUSHSQLERR ( genv->herr, en_S1090 );
+
+                return SQL_ERROR;
+        }
+
+        if( fDir != SQL_FETCH_FIRST
+         && fDir != SQL_FETCH_NEXT )
+        {
+                PUSHSQLERR ( genv->herr, en_S1103 );
+
+                return SQL_ERROR;
+        }
+
+        /*************************/
+
+        return SQL_SUCCESS;
+}
+
+RETCODE SQL_API SQLDrivers(
+                        HENV            henv,
+                        UWORD           fDir,
+                        UCHAR  FAR*     szDrvDesc,
+                        SWORD           cbDrvDescMax,
+                        SWORD  FAR*     pcbDrvDesc,
+                        UCHAR  FAR*     szDrvAttr,
+                        SWORD           cbDrvAttrMax,
+                        SWORD  FAR*     pcbDrvAttr )
 {
-       GENV_t FAR*     genv    = (GENV_t FAR*)henv;
-
-       if( henv == SQL_NULL_HENV )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       if( cbDrvDescMax <  0
-        || cbDrvAttrMax <  0 
-        || cbDrvAttrMax == 1 )
-       {
-               PUSHSQLERR ( genv->herr, en_S1090 );
-
-               return SQL_ERROR;
-       }
-
-       if( fDir != SQL_FETCH_FIRST
-        || fDir != SQL_FETCH_NEXT )
-       {
-               PUSHSQLERR ( genv->herr, en_S1103 );
-
-               return SQL_ERROR;
-       }
-       
-       /*********************/
-       return SQL_SUCCESS;
+        GENV_t FAR*     genv    = (GENV_t FAR*)henv;
+
+        if( henv == SQL_NULL_HENV )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        if( cbDrvDescMax <  0
+         || cbDrvAttrMax <  0
+         || cbDrvAttrMax == 1 )
+        {
+                PUSHSQLERR ( genv->herr, en_S1090 );
+
+                return SQL_ERROR;
+        }
+
+        if( fDir != SQL_FETCH_FIRST
+         || fDir != SQL_FETCH_NEXT )
+        {
+                PUSHSQLERR ( genv->herr, en_S1103 );
+
+                return SQL_ERROR;
+        }
+
+        /*********************/
+        return SQL_SUCCESS;
 }
 
 
-RETCODE SQL_API        SQLGetInfo(
-                       HDBC            hdbc,
-                       UWORD           fInfoType,
-                       PTR             rgbInfoValue,
-                       SWORD           cbInfoValueMax,
-                       SWORD FAR*      pcbInfoValue )
+RETCODE SQL_API SQLGetInfo(
+                        HDBC            hdbc,
+                        UWORD           fInfoType,
+                        PTR             rgbInfoValue,
+                        SWORD           cbInfoValueMax,
+                        SWORD FAR*      pcbInfoValue )
 {
-       DBC_t  FAR*     pdbc    = (DBC_t FAR*)hdbc;
-       ENV_t  FAR*     penv;
-       STMT_t FAR*     pstmt   = NULL;
-       STMT_t FAR*     tpstmt;
-       HPROC           hproc;
-       RETCODE         retcode = SQL_SUCCESS;
-
-       DWORD           dword = 0;
-       int             size = 0, len = 0;
-       char            buf[16] = { '\0' };
-
-       if( hdbc == SQL_NULL_HDBC 
-        || pdbc->henv == SQL_NULL_HENV )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       if( cbInfoValueMax < 0 )
-       {
-               PUSHSQLERR ( pdbc->herr, en_S1090 );
-
-               return SQL_ERROR;
-       }
-
-       if( /* fInfoType < SQL_INFO_FIRST || */
-           ( fInfoType > SQL_INFO_LAST
-          && fInfoType < SQL_INFO_DRIVER_START ) )
-       {
-               PUSHSQLERR ( pdbc->herr, en_S1096 );
-
-               return SQL_ERROR;
-       }
-
-       if( fInfoType == SQL_ODBC_VER )
-       {
-               sprintf( buf, "%02d.%02d", 
-                       (ODBCVER)>>8, 0x00FF&(ODBCVER) );
-
-               
-               if( rgbInfoValue != NULL 
-                && cbInfoValueMax > 0 )
-               {
-                       len = STRLEN( buf );
-
-                       if( len < cbInfoValueMax - 1 )
-                       {
-                               len = cbInfoValueMax - 1;
-                               PUSHSQLERR ( pdbc->herr, en_01004 );
-
-                               retcode = SQL_SUCCESS_WITH_INFO;
-                       }
-
-                       STRNCPY( rgbInfoValue, buf, len );
-                       ((char FAR*)rgbInfoValue)[len] = '\0';
-               }
-
-               if( pcbInfoValue != NULL )
-               {
-                       *pcbInfoValue = (SWORD)len;
-               }
-
-               return retcode;
-       }
-
-       if( pdbc->state == en_dbc_allocated 
-        || pdbc->state == en_dbc_needdata )
-       {
-               PUSHSQLERR ( pdbc->herr, en_08003 );
-
-               return SQL_ERROR;
-       }
-
-       switch( fInfoType )
-       {
-               case SQL_DRIVER_HDBC:
-                       dword = (DWORD)(pdbc->dhdbc);
-                       size  = sizeof(dword);
-                       break;
-
-               case SQL_DRIVER_HENV:
-                       penv  = (ENV_t FAR*)(pdbc->henv);
-                       dword = (DWORD)(penv->dhenv);
-                       size  = sizeof(dword);
-                       break;
-
-               case SQL_DRIVER_HLIB:
-                       penv  = (ENV_t FAR*)(pdbc->henv);
-                       dword = (DWORD)(penv->hdll);
-                       size  = sizeof(dword);
-                       break;
-
-               case SQL_DRIVER_HSTMT:
-                       if( rgbInfoValue != NULL )
-                       {
-                               pstmt = *((STMT_t FAR**)rgbInfoValue);
-                       }
-
-                       for( tpstmt  = (STMT_t FAR*)(pdbc->hstmt);
-                            tpstmt != NULL;
-                            tpstmt  = tpstmt->next )
-                       {
-                               if( tpstmt == pstmt )
-                               {
-                                       break;
-                               }
-                       }
-
-                       if( tpstmt == NULL )
-                       {
-                               PUSHSQLERR ( pdbc->herr, en_S1009 );
-       
-                               return SQL_ERROR;
-                       } 
-
-                       dword = (DWORD)(pstmt->dhstmt);
-                       size  = sizeof(dword);
-                       break;
-
-               default:
-                       break;
-       }
-
-       if( size )
-       {
-               if( rgbInfoValue != NULL )
-               {
-                       *((DWORD*)rgbInfoValue) = dword;
-               }
-
-               if( pcbInfoValue != NULL )
-               {
-                       *(pcbInfoValue) = (SWORD)size;
-               }
-
-               return SQL_SUCCESS;
-       }
-
-       hproc = _iodbcdm_getproc( hdbc, en_GetInfo );
-
-       if( hproc == SQL_NULL_HPROC )
-       {
-               PUSHSQLERR ( pdbc->herr, en_IM001 );
-
-               return SQL_ERROR;
-       }
-
-       CALL_DRIVER ( hdbc, retcode, hproc, en_GetInfo, (
-                       pdbc->dhdbc, 
-                       fInfoType,
-                       rgbInfoValue,
-                       cbInfoValueMax,
-                       pcbInfoValue ) )
+        DBC_t  FAR*     pdbc    = (DBC_t FAR*)hdbc;
+        ENV_t  FAR*     penv;
+        STMT_t FAR*     pstmt   = NULL;
+        STMT_t FAR*     tpstmt;
+        HPROC           hproc;
+        RETCODE         retcode = SQL_SUCCESS;
+
+        DWORD           dword;
+        int             size = 0, len = 0;
+        char            buf[16] = { '\0' };
+
+        if( hdbc == SQL_NULL_HDBC
+         || pdbc->henv == SQL_NULL_HENV )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        if( cbInfoValueMax < 0 )
+        {
+                PUSHSQLERR ( pdbc->herr, en_S1090 );
+
+                return SQL_ERROR;
+        }
+
+        if( /* fInfoType < SQL_INFO_FIRST || */
+            ( fInfoType > SQL_INFO_LAST
+           && fInfoType < SQL_INFO_DRIVER_START ) )
+        {
+                PUSHSQLERR ( pdbc->herr, en_S1096 );
+
+                return SQL_ERROR;
+        }
+
+        if( fInfoType == SQL_ODBC_VER )
+        {
+                sprintf( buf, "%02d.%02d",
+                        (ODBCVER)>>8, 0x00FF&(ODBCVER) );
+
+
+                if( rgbInfoValue != NULL
+                 && cbInfoValueMax > 0 )
+                {
+                        len = STRLEN( buf );
+
+                        if( len < cbInfoValueMax - 1 )
+                        {
+                                len = cbInfoValueMax - 1;
+                                PUSHSQLERR ( pdbc->herr, en_01004 );
+
+                                retcode = SQL_SUCCESS_WITH_INFO;
+                        }
+
+                        STRNCPY( rgbInfoValue, buf, len );
+                        ((char FAR*)rgbInfoValue)[len] = '\0';
+                }
+
+                if( pcbInfoValue != NULL )
+                {
+                        *pcbInfoValue = (SWORD)len;
+                }
+
+                return retcode;
+        }
+
+        if( pdbc->state == en_dbc_allocated
+         || pdbc->state == en_dbc_needdata )
+        {
+                PUSHSQLERR ( pdbc->herr, en_08003 );
+
+                return SQL_ERROR;
+        }
+
+        switch( fInfoType )
+        {
+                case SQL_DRIVER_HDBC:
+                        dword = (DWORD)(pdbc->dhdbc);
+                        size  = sizeof(dword);
+                        break;
+
+                case SQL_DRIVER_HENV:
+                        penv  = (ENV_t FAR*)(pdbc->henv);
+                        dword = (DWORD)(penv->dhenv);
+                        size  = sizeof(dword);
+                        break;
+
+                case SQL_DRIVER_HLIB:
+                        penv  = (ENV_t FAR*)(pdbc->henv);
+                        dword = (DWORD)(penv->hdll);
+                        size  = sizeof(dword);
+                        break;
+
+                case SQL_DRIVER_HSTMT:
+                        if( rgbInfoValue != NULL )
+                        {
+                                pstmt = *((STMT_t FAR**)rgbInfoValue);
+                        }
+
+                        for( tpstmt  = (STMT_t FAR*)(pdbc->hstmt);
+                             tpstmt != NULL;
+                             tpstmt  = tpstmt->next )
+                        {
+                                if( tpstmt == pstmt )
+                                {
+                                        break;
+                                }
+                        }
+
+                        if( tpstmt == NULL )
+                        {
+                                PUSHSQLERR ( pdbc->herr, en_S1009 );
+
+                                return SQL_ERROR;
+                        }
+
+                        dword = (DWORD)(pstmt->dhstmt);
+                        size  = sizeof(dword);
+                        break;
+
+                default:
+                        break;
+        }
+
+        if( size )
+        {
+                if( rgbInfoValue != NULL )
+                {
+                        *((DWORD*)rgbInfoValue) = dword;
+                }
+
+                if( pcbInfoValue != NULL )
+                {
+                        *(pcbInfoValue) = (SWORD)size;
+                }
+
+                return SQL_SUCCESS;
+        }
+
+        hproc = _iodbcdm_getproc( hdbc, en_GetInfo );
+
+        if( hproc == SQL_NULL_HPROC )
+        {
+                PUSHSQLERR ( pdbc->herr, en_IM001 );
+
+                return SQL_ERROR;
+        }
+
+        CALL_DRIVER ( hdbc, retcode, hproc, en_GetInfo, (
+                        pdbc->dhdbc,
+                        fInfoType,
+                        rgbInfoValue,
+                        cbInfoValueMax,
+                        pcbInfoValue ) )
 
 #if 0
-       retcode = hproc(pdbc->dhdbc, 
-                       fInfoType,
-                       rgbInfoValue,
-                       cbInfoValueMax,
-                       pcbInfoValue );
+        retcode = hproc(pdbc->dhdbc,
+                        fInfoType,
+                        rgbInfoValue,
+                        cbInfoValueMax,
+                        pcbInfoValue );
 #endif
 
-       if( retcode == SQL_ERROR 
-        && fInfoType == SQL_DRIVER_ODBC_VER )
-       {
-               STRCPY( buf, "01.00" );
+        if( retcode == SQL_ERROR
+         && fInfoType == SQL_DRIVER_ODBC_VER )
+        {
+                STRCPY( buf, "01.00" );
 
-               if( rgbInfoValue != NULL 
-                && cbInfoValueMax > 0 )
-               {
-                       len = STRLEN( buf );
+                if( rgbInfoValue != NULL
+                 && cbInfoValueMax > 0 )
+                {
+                        len = STRLEN( buf );
 
-                       if( len < cbInfoValueMax - 1 )
-                       {
-                               len = cbInfoValueMax - 1;
-                               PUSHSQLERR ( pdbc->herr, en_01004 );
-                       }
+                        if( len < cbInfoValueMax - 1 )
+                        {
+                                len = cbInfoValueMax - 1;
+                                PUSHSQLERR ( pdbc->herr, en_01004 );
+                        }
 
-                       STRNCPY( rgbInfoValue, buf, len );
-                       ((char FAR*)rgbInfoValue)[len] = '\0';
-               }
+                        STRNCPY( rgbInfoValue, buf, len );
+                        ((char FAR*)rgbInfoValue)[len] = '\0';
+                }
 
-               if( pcbInfoValue != NULL )
-               {
-                       *pcbInfoValue = (SWORD)len;
-               }
+                if( pcbInfoValue != NULL )
+                {
+                        *pcbInfoValue = (SWORD)len;
+                }
 
-               /* what should we return in this case ???? */
-       }
+                /* what should we return in this case ???? */
+        }
 
-       return retcode;
-}      
+        return retcode;
+}
 
 RETCODE SQL_API SQLGetFunctions(
-                       HDBC            hdbc,
-                       UWORD           fFunc,
-                       UWORD FAR*      pfExists )
+                        HDBC            hdbc,
+                        UWORD           fFunc,
+                        UWORD FAR*      pfExists )
 {
-       DBC_t FAR*      pdbc    = (DBC_t FAR*)hdbc;
-       HPROC           hproc;
-       RETCODE         retcode;
+        DBC_t FAR*      pdbc    = (DBC_t FAR*)hdbc;
+        HPROC           hproc;
+        RETCODE         retcode;
 
-       if( hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
+        if( hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
 
-       if( fFunc > SQL_EXT_API_LAST )
-       {
-               PUSHSQLERR ( pdbc->herr, en_S1095 );
+        if( fFunc > SQL_EXT_API_LAST )
+        {
+                PUSHSQLERR ( pdbc->herr, en_S1095 );
 
-               return SQL_ERROR;
-       }
+                return SQL_ERROR;
+        }
 
-       if( pdbc->state == en_dbc_allocated 
-        || pdbc->state == en_dbc_needdata )
-       {
-               PUSHSQLERR ( pdbc->herr, en_S1010 );
+        if( pdbc->state == en_dbc_allocated
+         || pdbc->state == en_dbc_needdata )
+        {
+                PUSHSQLERR ( pdbc->herr, en_S1010 );
 
-               return SQL_ERROR;
-       }
+                return SQL_ERROR;
+        }
 
-       if( pfExists == NULL )
-       {
-               return SQL_SUCCESS;
-       }
+        if( pfExists == NULL )
+        {
+                return SQL_SUCCESS;
+        }
 
-       hproc = _iodbcdm_getproc( hdbc, en_GetFunctions );
+        hproc = _iodbcdm_getproc( hdbc, en_GetFunctions );
 
-       if( hproc != SQL_NULL_HPROC )
-       {
-               CALL_DRIVER ( hdbc, retcode, hproc, en_GetFunctions, (
-                               pdbc->dhdbc, fFunc, pfExists ) )
+        if( hproc != SQL_NULL_HPROC )
+        {
+                CALL_DRIVER ( hdbc, retcode, hproc, en_GetFunctions, (
+                                pdbc->dhdbc, fFunc, pfExists ) )
 
 #if 0
-               retcode = hproc( pdbc->dhdbc, fFunc, pfExists );
+                retcode = hproc( pdbc->dhdbc, fFunc, pfExists );
 #endif
-               return retcode;
-       }
-
-       if( fFunc == SQL_API_SQLSETPARAM )
-       {
-               fFunc = SQL_API_SQLBINDPARAMETER;
-       }
-
-       if( fFunc != SQL_API_ALL_FUNCTIONS )
-       {
-               hproc = _iodbcdm_getproc( hdbc, fFunc );
-
-               if( hproc == SQL_NULL_HPROC )
-               {
-                       *pfExists = (UWORD)0;
-               }
-               else
-               {
-                       *pfExists = (UWORD)1;
-               }
-
-               return SQL_SUCCESS;
-       }
-
-       for( fFunc=0 ; fFunc < 100; fFunc ++ )
-       {
-               hproc = _iodbcdm_getproc( hdbc, fFunc );
-
-               if( hproc == SQL_NULL_HPROC )
-               {
-                       pfExists[fFunc] = (UWORD)0;
-               }
-               else
-               {
-                       pfExists[fFunc] = (UWORD)1;
-               }
-       }
-
-       return SQL_SUCCESS;
+                return retcode;
+        }
+
+        if( fFunc == SQL_API_SQLSETPARAM )
+        {
+                fFunc = SQL_API_SQLBINDPARAMETER;
+        }
+
+        if( fFunc != SQL_API_ALL_FUNCTIONS )
+        {
+                hproc = _iodbcdm_getproc( hdbc, fFunc );
+
+                if( hproc == SQL_NULL_HPROC )
+                {
+                        *pfExists = (UWORD)0;
+                }
+                else
+                {
+                        *pfExists = (UWORD)1;
+                }
+
+                return SQL_SUCCESS;
+        }
+
+        for( fFunc=0 ; fFunc < 100; fFunc ++ )
+        {
+                hproc = _iodbcdm_getproc( hdbc, fFunc );
+
+                if( hproc == SQL_NULL_HPROC )
+                {
+                        pfExists[fFunc] = (UWORD)0;
+                }
+                else
+                {
+                        pfExists[fFunc] = (UWORD)1;
+                }
+        }
+
+        return SQL_SUCCESS;
 }
index d26cbe866987e1bbcb6c963a21b938be735f7cb7..df5df0860f2d559c325c71b20bc39a9a308fc77f 100644 (file)
 #ifndef _INTRINSIC_SQL_H
 # define _INTRINSIC_SQL_H
 
-typedef unsigned char          UCHAR;
-typedef long int               SDWORD;
-typedef short int              SWORD;
-typedef unsigned long int      UDWORD; 
-typedef unsigned short int     UWORD;
-
-typedef void FAR*              PTR;
-
-typedef void FAR*              HENV;
-typedef void FAR*              HDBC;
-typedef void FAR*              HSTMT;
-
-typedef signed short           RETCODE;
-
-# ifdef WIN32
-#   define SQL_API                     __stdcall
-# else
-#   define SQL_API                     EXPORT CALLBACK
-# endif
-
-# define ODBCVER                       0x0200
-
-# define SQL_MAX_MESSAGE_LENGTH                512
-# define SQL_MAX_DSN_LENGTH            32
+#ifndef OS2
+typedef unsigned char           UCHAR;
+#endif
+typedef long int                SDWORD;
+typedef short int               SWORD;
+typedef unsigned long int       UDWORD;
+typedef unsigned short int      UWORD;
+typedef unsigned int            UINT;
+
+#ifndef FAR
+#  define FAR
+#endif
+#ifndef NEAR                                                                    
+#  define NEAR                                                                 
+#endif       
+#ifndef HANDLE                                                                  
+  typedef int                          HANDLE;                                 
+  #endif          
+#ifndef HGLOBAL                                                                  
+  typedef HANDLE                          HGLOBAL;                                 
+  #endif          
+#ifndef SQL_INDEX_OTHER                                                                  
+#define SQL_INDEX_OTHER                 3
+  #endif          
+
+#  ifndef BOOL
+#    define BOOL                       int
+#  endif
+#  ifndef CHAR
+#    define CHAR                       char
+#  endif
+#  ifndef FALSE
+#    define FALSE                      (0 != 0)
+#  endif
+#  ifndef HWND
+#    define HWND                       int
+#  endif
+#  ifndef SQLHWND
+#    define SQLHWND                       int
+#  endif
+#  ifndef LONG
+#    define LONG                       long
+#  endif
+#  ifndef PASCAL
+#    define PASCAL
+#  endif
+#  ifndef SHORT
+#    define SHORT                      short
+#  endif
+#  ifndef SQL_API
+#    define SQL_API
+#  endif
+#  ifndef SQL_LOCAL_API
+#    define SQL_LOCAL_API
+#  endif
+#  ifndef TRUE
+#    define TRUE                       (0 == 0)
+#  endif
+
+typedef struct tagDATE_STRUCT
+{
+SWORD    year;
+UWORD   month;
+UWORD   day;
+} DATE_STRUCT;
+
+typedef struct tagTIME_STRUCT
+{
+UWORD   hour;
+UWORD   minute;
+UWORD   second;
+} TIME_STRUCT;
+
+typedef struct tagTIMESTAMP_STRUCT
+{
+SWORD    year;
+UWORD   month;
+UWORD   day;
+UWORD   hour;
+UWORD   minute;
+UWORD   second;
+UDWORD    fraction;
+} TIMESTAMP_STRUCT;
+
+
+
+typedef UCHAR FAR*               PTR,
+             FAR*               SQLPTR;
+
+typedef void FAR*               HENV,
+             FAR*               SQLHENV;
+typedef void FAR*               HDBC,
+             FAR*               SQLHDBC;
+typedef void FAR*               HSTMT,
+             FAR*               SQLHSTMT;
+typedef SDWORD                  SQLINTEGER;  
+typedef signed short            RETCODE;
+typedef UCHAR                   SQLCHAR;
+typedef UWORD                   SQLUSMALLINT;
+typedef PTR              SQLPOINTER;
+typedef SWORD                   SQLSMALLINT;
+typedef UDWORD                  SQLUINTEGER;
+
+#  ifdef WIN32
+#    define SQL_API                     __stdcall
+#  else
+#    define SQL_API                     /* giovanni EXPORT CALLBACK */
+#  endif
+#  ifdef OS2
+#    ifdef BCPP
+#      define _Optlink
+#      define _System                  _syscall
+#    endif
+#    undef  SQL_API
+#    define SQL_API                    _System
+#  endif
+
+
+#ifndef ODBCVER
+# define ODBCVER                        0x0200
+#endif
+
+# define SQL_MAX_MESSAGE_LENGTH         512
+# define SQL_MAX_DSN_LENGTH             32
 
 /* return code */
-# define SQL_INVALID_HANDLE            (-2)
-# define SQL_ERROR                     (-1)
-# define SQL_SUCCESS                   0
-# define SQL_SUCCESS_WITH_INFO         1
-# define SQL_NO_DATA_FOUND             100
+# define SQL_INVALID_HANDLE             (-2)
+# define SQL_ERROR                      (-1)
+# define SQL_SUCCESS                    0
+# define SQL_SUCCESS_WITH_INFO          1
+# define SQL_NO_DATA_FOUND              100
 
 /* standard SQL datatypes (agree with ANSI type numbering) */
-# define SQL_CHAR                      1
-# define SQL_NUMERIC                   2
-# define SQL_DECIMAL                   3
-# define SQL_INTEGER                   4
-# define SQL_SMALLINT                  5
-# define SQL_FLOAT                     6
-# define SQL_REAL                      7
-# define SQL_DOUBLE                    8
-# define SQL_VARCHAR                   12
-
-# define SQL_TYPE_MIN                  SQL_CHAR
-# define SQL_TYPE_NULL                 0
-# define SQL_TYPE_MAX                  SQL_VARCHAR
+# define SQL_CHAR                       1
+# define SQL_NUMERIC                    2
+# define SQL_DECIMAL                    3
+# define SQL_INTEGER                    4
+# define SQL_SMALLINT                   5
+# define SQL_FLOAT                      6
+# define SQL_REAL                       7
+# define SQL_DOUBLE                     8
+# define SQL_VARCHAR                    12
+
+# define SQL_TYPE_MIN                   SQL_CHAR
+# define SQL_TYPE_NULL                  0
+# define SQL_TYPE_MAX                   SQL_VARCHAR
 
 /* C to SQL datatype mapping */
-# define SQL_C_CHAR                    SQL_CHAR
-# define SQL_C_LONG                    SQL_INTEGER
-# define SQL_C_SHORT                           SQL_SMALLINT
-# define SQL_C_FLOAT                           SQL_REAL
-# define SQL_C_DOUBLE                  SQL_DOUBLE
-# define SQL_C_DEFAULT                         99
+# define SQL_C_CHAR                     SQL_CHAR
+# define SQL_C_LONG                     SQL_INTEGER
+# define SQL_C_SHORT                    SQL_SMALLINT
+# define SQL_C_FLOAT                    SQL_REAL
+# define SQL_C_DOUBLE                   SQL_DOUBLE
+# define SQL_C_DEFAULT                  99
 
-# define SQL_NO_NULLS                  0
-# define SQL_NULLABLE                  1
-# define SQL_NULLABLE_UNKNOWN          2
+# define SQL_NO_NULLS                   0
+# define SQL_NULLABLE                   1
+# define SQL_NULLABLE_UNKNOWN           2
 
 /* some special length values */
-# define SQL_NULL_DATA                 (-1)
-# define SQL_DATA_AT_EXEC              (-2)
-# define SQL_NTS                       (-3)
+# define SQL_NULL_DATA                  (-1)
+# define SQL_DATA_AT_EXEC               (-2)
+# define SQL_NTS                        (-3)
 
 /* SQLFreeStmt flag values */
-# define SQL_CLOSE                     0
-# define SQL_DROP                      1
-# define SQL_UNBIND                    2
-# define SQL_RESET_PARAMS              3
+# define SQL_CLOSE                      0
+# define SQL_DROP                       1
+# define SQL_UNBIND                     2
+# define SQL_RESET_PARAMS               3
 
 /* SQLTransact flag values */
-# define SQL_COMMIT                    0
-# define SQL_ROLLBACK                  1
+# define SQL_COMMIT                     0
+# define SQL_ROLLBACK                   1
 
 /* SQLColAttributes flag values */
-# define SQL_COLUMN_COUNT              0
-# define SQL_COLUMN_LABEL              18
-# define SQL_COLATT_OPT_MAX            SQL_COLUMN_LABEL
-# define SQL_COLUMN_DRIVER_START       1000
+# define SQL_COLUMN_COUNT               0
+# define SQL_COLUMN_LABEL               18
+# define SQL_COLATT_OPT_MAX             SQL_COLUMN_LABEL
+# define SQL_COLUMN_DRIVER_START        1000
 
-# define SQL_COLATT_OPT_MIN            SQL_COLUMN_COUNT
+# define SQL_COLATT_OPT_MIN             SQL_COLUMN_COUNT
 
 /* Null handles */
-# define SQL_NULL_HENV                 0
-# define SQL_NULL_HDBC                 0
-# define SQL_NULL_HSTMT                        0
+# define SQL_NULL_HENV                  0
+# define SQL_NULL_HDBC                  0
+# define SQL_NULL_HSTMT                 0
+
+#endif
 
-#endif  
index a4bae149c4d1d35cb8a7e7fdeafea3c5da3acf1e..26e9ee5b5fc473584d64483b5955c02658ec0864 100644 (file)
-#ifndef        _INTRINSIC_SQLEXT_H
+#ifndef _INTRINSIC_SQLEXT_H
 # define _INTRINSIC_SQLEXT_H
 
-# include      <../iodbc/isql.h>
+# include       <isql.h>
 
-# define SQL_STILL_EXECUTING           2
-# define SQL_NEED_DATA                 99
+# define SQL_STILL_EXECUTING            2
+# define SQL_NEED_DATA                  99
 
 /* extend SQL datatypes */
-# define SQL_DATE                      9
-# define SQL_TIME                      10
-# define SQL_TIMESTAMP                 11
-# define SQL_LONGVARCHAR               (-1)
-# define SQL_BINARY                    (-2)
-# define SQL_VARBINARY                 (-3)
-# define SQL_LONGVARBINARY             (-4)
-# define SQL_BIGINT                    (-5)
-# define SQL_TINYINT                   (-6)
-# define SQL_BIT                       (-7)    /* conflict with SQL3 ??? */
-# define SQL_TYPE_DRIVER_START         (-80)
+# define SQL_DATE                       9
+# define SQL_TIME                       10
+# define SQL_TIMESTAMP                  11
+# define SQL_LONGVARCHAR                (-1)
+# define SQL_BINARY                     (-2)
+# define SQL_VARBINARY                  (-3)
+# define SQL_LONGVARBINARY              (-4)
+# define SQL_BIGINT                     (-5)
+# define SQL_TINYINT                    (-6)
+# define SQL_BIT                        (-7)    /* conflict with SQL3 ??? */
+# define SQL_TYPE_DRIVER_START          (-80)
 
 /* C to SQL datatype mapping */
-# define SQL_C_DATE                    SQL_DATE
-# define SQL_C_TIME                    SQL_TIME
-# define SQL_C_TIMESTAMP               SQL_TIMESTAMP
-# define SQL_C_BINARY                  SQL_BINARY
-# define SQL_C_BIT                     SQL_BIT
-# define SQL_C_TINYINT                 SQL_TINYINT
-
-# define SQL_SIGNED_OFFSET             (-20)
-# define SQL_UNSIGNED_OFFSET           (-22)
-
-# define SQL_C_SLONG                   (SQL_C_LONG  + SQL_SIGNED_OFFSET)
-# define SQL_C_SSHORT                  (SQL_C_SHORT + SQL_SIGNED_OFFSET)
-# define SQL_C_STINYINT                        (SQL_TINYINT + SQL_SIGNED_OFFSET)
-# define SQL_C_ULONG                   (SQL_C_LONG  + SQL_UNSIGNED_OFFSET)
-# define SQL_C_USHORT                  (SQL_C_SHORT + SQL_UNSIGNED_OFFSET)
-# define SQL_C_UTINYINT                        (SQL_TINYINT + SQL_UNSIGNED_OFFSET)
-# define SQL_C_BOOKMARK                        SQL_C_ULONG                     
+# define SQL_C_DATE                     SQL_DATE
+# define SQL_C_TIME                     SQL_TIME
+# define SQL_C_TIMESTAMP                SQL_TIMESTAMP
+# define SQL_C_BINARY                   SQL_BINARY
+# define SQL_C_BIT                      SQL_BIT
+# define SQL_C_TINYINT                  SQL_TINYINT
+
+# define SQL_SIGNED_OFFSET              (-20)
+# define SQL_UNSIGNED_OFFSET            (-22)
+
+# define SQL_C_SLONG                    (SQL_C_LONG  + SQL_SIGNED_OFFSET)
+# define SQL_C_SSHORT                   (SQL_C_SHORT + SQL_SIGNED_OFFSET)
+# define SQL_C_STINYINT                 (SQL_TINYINT + SQL_SIGNED_OFFSET)
+# define SQL_C_ULONG                    (SQL_C_LONG  + SQL_UNSIGNED_OFFSET)
+# define SQL_C_USHORT                   (SQL_C_SHORT + SQL_UNSIGNED_OFFSET)
+# define SQL_C_UTINYINT                 (SQL_TINYINT + SQL_UNSIGNED_OFFSET)
+# define SQL_C_BOOKMARK                 SQL_C_ULONG
 
 # if defined(SQL_TYPE_MIN)
-#   undef  SQL_TYPE_MIN  
-#   define SQL_TYPE_MIN                        SQL_BIT 
-/* Note:If SQL_BIT uses SQL3 value (i.e. 14) then, 
- *     SQL_TYPE_MIN need to be defined as SQL_TINYINT 
- *     (i.e. -6).
+#   undef  SQL_TYPE_MIN
+#   define SQL_TYPE_MIN                 SQL_BIT
+/* Note:If SQL_BIT uses SQL3 value (i.e. 14) then,
+ *      SQL_TYPE_MIN need to be defined as SQL_TINYINT
+ *      (i.e. -6).
  */
 # endif
 
-# define SQL_ALL_TYPES                 0
+# define SQL_ALL_TYPES                  0
 
 /* SQLDriverConnect flag values */
-# define SQL_DRIVER_NOPROMPT           0
-# define SQL_DRIVER_COMPLETE           1
-# define SQL_DRIVER_PROMPT             2
-# define SQL_DRIVER_COMPLETE_REQUIRED  3
+# define SQL_DRIVER_NOPROMPT            0
+# define SQL_DRIVER_COMPLETE            1
+# define SQL_DRIVER_PROMPT              2
+# define SQL_DRIVER_COMPLETE_REQUIRED   3
 
 /* SQLSetParam extensions */
-# define SQL_DEFAULT_PARAM             (-5)
-# define SQL_IGNORE                    (-6)
+# define SQL_DEFAULT_PARAM              (-5)
+# define SQL_IGNORE                     (-6)
 
 /* function number for SQLGetFunctions and _iodbcdm_getproc */
-# define SQL_API_SQLALLOCCONNECT       1   
-# define SQL_API_SQLALLOCENV           2
-# define SQL_API_SQLALLOCSTMT          3
-# define SQL_API_SQLBINDCOL            4
-# define SQL_API_SQLCANCEL             5
-# define SQL_API_SQLCOLATTRIBUTES      6
-# define SQL_API_SQLCONNECT            7
-# define SQL_API_SQLDESCRIBECOL                8
-# define SQL_API_SQLDISCONNECT         9
-# define SQL_API_SQLERROR              10
-# define SQL_API_SQLEXECDIRECT         11
-# define SQL_API_SQLEXECUTE            12
-# define SQL_API_SQLFETCH              13
-# define SQL_API_SQLFREECONNECT                14
-# define SQL_API_SQLFREEENV            15
-# define SQL_API_SQLFREESTMT           16 
-# define SQL_API_SQLGETCURSORNAME      17
-# define SQL_API_SQLNUMRESULTCOLS      18
-# define SQL_API_SQLPREPARE            19
-# define SQL_API_SQLROWCOUNT           20
-# define SQL_API_SQLSETCURSORNAME      21
-# define SQL_API_SQLSETPARAM           22
-# define SQL_API_SQLTRANSACT           23
-
-# define SQL_NUM_FUNCTIONS             23
-
-# define SQL_EXT_API_START             40
-
-# define SQL_API_SQLCOLUMNS            40
-
-# define SQL_API_SQLDRIVERCONNECT      41
-# define SQL_API_SQLGETCONNECTOPTION   42
-# define SQL_API_SQLGETDATA            43
-# define SQL_API_SQLGETFUNCTIONS       44
-# define SQL_API_SQLGETINFO            45
-# define SQL_API_SQLGETSTMTOPTION      46
-# define SQL_API_SQLGETTYPEINFO                47
-# define SQL_API_SQLPARAMDATA          48
-# define SQL_API_SQLPUTDATA            49
-# define SQL_API_SQLSETCONNECTOPTION   50
-# define SQL_API_SQLSETSTMTOPTION      51
-# define SQL_API_SQLSPECIALCOLUMNS     52
-# define SQL_API_SQLSTATISTICS         53
-# define SQL_API_SQLTABLES             54
-
-# define SQL_API_SQLBROWSECONNECT      55
-# define SQL_API_SQLCOLUMNPRIVILEGES   56
-# define SQL_API_SQLDATASOURCES                57
-# define SQL_API_SQLDESCRIBEPARAM      58
-# define SQL_API_SQLEXTENDEDFETCH      59
-# define SQL_API_SQLFOREIGNKEYS                60
-# define SQL_API_SQLMORERESULTS                61
-# define SQL_API_SQLNATIVESQL          62
-# define SQL_API_SQLNUMPARAMS          63
-# define SQL_API_SQLPARAMOPTIONS       64
-# define SQL_API_SQLPRIMARYKEYS                65
-# define SQL_API_SQLPROCEDURECOLUMNS   66
-# define SQL_API_SQLPROCEDURES         67
-# define SQL_API_SQLSETPOS             68
-# define SQL_API_SQLSETSCROLLOPTIONS   69
-# define SQL_API_SQLTABLEPRIVILEGES    70
-
-# define SQL_API_SQLDRIVERS            71
-# define SQL_API_SQLBINDPARAMETER      72
-# define SQL_EXT_API_LAST              SQL_API_SQLBINDPARAMETER
-
-# define SQL_API_ALL_FUNCTIONS         0
+# define SQL_API_SQLALLOCCONNECT        1
+# define SQL_API_SQLALLOCENV            2
+# define SQL_API_SQLALLOCSTMT           3
+# define SQL_API_SQLBINDCOL             4
+# define SQL_API_SQLCANCEL              5
+# define SQL_API_SQLCOLATTRIBUTES       6
+# define SQL_API_SQLCONNECT             7
+# define SQL_API_SQLDESCRIBECOL         8
+# define SQL_API_SQLDISCONNECT          9
+# define SQL_API_SQLERROR               10
+# define SQL_API_SQLEXECDIRECT          11
+# define SQL_API_SQLEXECUTE             12
+# define SQL_API_SQLFETCH               13
+# define SQL_API_SQLFREECONNECT         14
+# define SQL_API_SQLFREEENV             15
+# define SQL_API_SQLFREESTMT            16
+# define SQL_API_SQLGETCURSORNAME       17
+# define SQL_API_SQLNUMRESULTCOLS       18
+# define SQL_API_SQLPREPARE             19
+# define SQL_API_SQLROWCOUNT            20
+# define SQL_API_SQLSETCURSORNAME       21
+# define SQL_API_SQLSETPARAM            22
+# define SQL_API_SQLTRANSACT            23
+
+# define SQL_NUM_FUNCTIONS              23
+
+# define SQL_EXT_API_START              40
+
+# define SQL_API_SQLCOLUMNS             40
+
+# define SQL_API_SQLDRIVERCONNECT       41
+# define SQL_API_SQLGETCONNECTOPTION    42
+# define SQL_API_SQLGETDATA             43
+# define SQL_API_SQLGETFUNCTIONS        44
+# define SQL_API_SQLGETINFO             45
+# define SQL_API_SQLGETSTMTOPTION       46
+# define SQL_API_SQLGETTYPEINFO         47
+# define SQL_API_SQLPARAMDATA           48
+# define SQL_API_SQLPUTDATA             49
+# define SQL_API_SQLSETCONNECTOPTION    50
+# define SQL_API_SQLSETSTMTOPTION       51
+# define SQL_API_SQLSPECIALCOLUMNS      52
+# define SQL_API_SQLSTATISTICS          53
+# define SQL_API_SQLTABLES              54
+
+# define SQL_API_SQLBROWSECONNECT       55
+# define SQL_API_SQLCOLUMNPRIVILEGES    56
+# define SQL_API_SQLDATASOURCES         57
+# define SQL_API_SQLDESCRIBEPARAM       58
+# define SQL_API_SQLEXTENDEDFETCH       59
+# define SQL_API_SQLFOREIGNKEYS         60
+# define SQL_API_SQLMORERESULTS         61
+# define SQL_API_SQLNATIVESQL           62
+# define SQL_API_SQLNUMPARAMS           63
+# define SQL_API_SQLPARAMOPTIONS        64
+# define SQL_API_SQLPRIMARYKEYS         65
+# define SQL_API_SQLPROCEDURECOLUMNS    66
+# define SQL_API_SQLPROCEDURES          67
+# define SQL_API_SQLSETPOS              68
+# define SQL_API_SQLSETSCROLLOPTIONS    69
+# define SQL_API_SQLTABLEPRIVILEGES     70
+
+# define SQL_API_SQLDRIVERS             71
+# define SQL_API_SQLBINDPARAMETER       72
+# define SQL_EXT_API_LAST               SQL_API_SQLBINDPARAMETER
+
+# define SQL_API_ALL_FUNCTIONS          0
 
 /* SQLGetInfo infor number */
-# define SQL_INFO_FIRST                        0
-# define SQL_DRIVER_HDBC               3
-# define SQL_DRIVER_HENV               4
-# define SQL_DRIVER_HSTMT              5
-# define SQL_DRIVER_NAME               6
-# define SQL_ODBC_VER                  10
-# define SQL_CURSOR_COMMIT_BEHAVIOR    23
-# define SQL_CURSOR_ROLLBACK_BEHAVIOR  24
-# define SQL_DEFAULT_TXN_ISOLATION     26
+# define SQL_INFO_FIRST                 0
+# define SQL_DRIVER_HDBC                3
+# define SQL_DRIVER_HENV                4
+# define SQL_DRIVER_HSTMT               5
+# define SQL_DRIVER_NAME                6
+# define SQL_ODBC_VER                   10
+# define SQL_CURSOR_COMMIT_BEHAVIOR     23
+# define SQL_CURSOR_ROLLBACK_BEHAVIOR   24
+# define SQL_DEFAULT_TXN_ISOLATION      26
 
-# define SQL_TXN_ISOLATION_OPTION      72
-# define SQL_NON_NULLABLE_COLUMNS      75
+# define SQL_TXN_ISOLATION_OPTION       72
+# define SQL_NON_NULLABLE_COLUMNS       75
 
-# define SQL_DRIVER_HLIB               76
-# define SQL_DRIVER_ODBC_VER           77
+# define SQL_DRIVER_HLIB                76
+# define SQL_DRIVER_ODBC_VER            77
 
-# define SQL_QUALIFIER_LOCATION                114
+# define SQL_QUALIFIER_LOCATION         114
 
-# define SQL_INFO_LAST                 SQL_QUALIFIER_LOCATION
+# define SQL_INFO_LAST                  SQL_QUALIFIER_LOCATION
 
-# define SQL_INFO_DRIVER_START         1000
+# define SQL_INFO_DRIVER_START          1000
 
 
 /* SQL_TXN_ISOLATION_OPTION masks */
-# define SQL_TXN_READ_UNCOMMITTED      0x00000001L
-# define SQL_TXN_READ_COMMITTED                0x00000002L
-# define SQL_TXN_REPEATABLE_READ       0x00000004L
-# define SQL_TXN_SERIALIZABLE          0x00000008L
-# define SQL_TXN_VERSIONING            0x00000010L
+# define SQL_TXN_READ_UNCOMMITTED       0x00000001L
+# define SQL_TXN_READ_COMMITTED         0x00000002L
+# define SQL_TXN_REPEATABLE_READ        0x00000004L
+# define SQL_TXN_SERIALIZABLE           0x00000008L
+# define SQL_TXN_VERSIONING             0x00000010L
 
 /* SQL_CURSOR_COMMIT_BEHAVIOR and SQL_CURSOR_ROLLBACK_BEHAVIOR values */
 
-# define SQL_CB_DELETE                 0x0000
-# define SQL_CB_CLOSE                  0x0001
-# define SQL_CB_PRESERVE               0x0002
+# define SQL_CB_DELETE                  0x0000
+# define SQL_CB_CLOSE                   0x0001
+# define SQL_CB_PRESERVE                0x0002
 
 /* options for SQLGetStmtOption/SQLSetStmtOption */
-# define SQL_QUERY_TIMEOUT             0
-# define SQL_MAX_ROWS                  1
-# define SQL_NOSCAN                    2
-# define SQL_MAX_LENGTH                        3
-# define SQL_ASYNC_ENABLE              4
-# define SQL_BIND_TYPE                 5
-# define SQL_CURSOR_TYPE               6
-# define SQL_CONCURRENCY               7
-# define SQL_KEYSET_SIZE               8
-# define SQL_ROWSET_SIZE               9
-# define SQL_SIMULATE_CURSOR           10
-# define SQL_RETRIEVE_DATA             11
-# define SQL_USE_BOOKMARKS             12
-# define SQL_GET_BOOKMARK              13      /* GetStmtOption Only */
-# define SQL_ROW_NUMBER                        14      /* GetStmtOption Only */
-# define SQL_STMT_OPT_MAX              SQL_ROW_NUMBER
-
-# define SQL_STMT_OPT_MIN              SQL_QUERY_TIMEOUT
+# define SQL_QUERY_TIMEOUT              0
+# define SQL_MAX_ROWS                   1
+# define SQL_NOSCAN                     2
+# define SQL_MAX_LENGTH                 3
+# define SQL_ASYNC_ENABLE               4
+# define SQL_BIND_TYPE                  5
+# define SQL_CURSOR_TYPE                6
+# define SQL_CONCURRENCY                7
+# define SQL_KEYSET_SIZE                8
+# define SQL_ROWSET_SIZE                9
+# define SQL_SIMULATE_CURSOR            10
+# define SQL_RETRIEVE_DATA              11
+# define SQL_USE_BOOKMARKS              12
+# define SQL_GET_BOOKMARK               13      /* GetStmtOption Only */
+# define SQL_ROW_NUMBER                 14      /* GetStmtOption Only */
+# define SQL_STMT_OPT_MAX               SQL_ROW_NUMBER
+
+# define SQL_STMT_OPT_MIN               SQL_QUERY_TIMEOUT
 
 
 /* SQL_QUERY_TIMEOUT options */
-# define SQL_QUERY_TIMEOUT_DEFAULT     0UL
+# define SQL_QUERY_TIMEOUT_DEFAULT      0UL
 
 /* SQL_MAX_ROWS options */
-# define SQL_MAX_ROWS_DEFAULT          0UL
+# define SQL_MAX_ROWS_DEFAULT           0UL
 
 /* SQL_MAX_LENGTH options */
-# define SQL_MAX_LENGTH_DEFAULT                0UL
+# define SQL_MAX_LENGTH_DEFAULT         0UL
 
 /* SQL_CONCURRENCY options */
-# define SQL_CONCUR_READ_ONLY          1
-# define SQL_CONCUR_LOCK               2
-# define SQL_CONCUR_ROWVER             3
-# define SQL_CONCUR_VALUES             4
+# define SQL_CONCUR_READ_ONLY           1
+# define SQL_CONCUR_LOCK                2
+# define SQL_CONCUR_ROWVER              3
+# define SQL_CONCUR_VALUES              4
+
+/* SQL_CURSOR_TYPE options */
+#define SQL_CURSOR_FORWARD_ONLY                0UL
+#define SQL_CURSOR_KEYSET_DRIVEN       1UL
+#define SQL_CURSOR_DYNAMIC             2UL
+#define SQL_CURSOR_STATIC               3UL
+#define SQL_CURSOR_TYPE_DEFAULT                SQL_CURSOR_FORWARD_ONLY
 
 /* options for SQLSetConnectOption/SQLGetConnectOption */
-# define SQL_ACCESS_MODE               101
-# define SQL_AUTOCOMMIT                        102
-# define SQL_LOGIN_TIMEOUT             103
-# define SQL_OPT_TRACE                 104
-# define SQL_OPT_TRACEFILE             105
-# define SQL_TRANSLATE_DLL             106
-# define SQL_TRANSLATE_OPTION          107
-# define SQL_TXN_ISOLATION             108
-# define SQL_CURRENT_QUALIFIER         109
-# define SQL_ODBC_CURSORS              110
-# define SQL_QUIET_MODE                        111
-# define SQL_PACKET_SIZE               112
-# define SQL_CONN_OPT_MAX              SQL_PACKET_SIZE
-# define SQL_CONNECT_OPT_DRVR_START    1000
-
-# define SQL_CONN_OPT_MIN              SQL_ACCESS_MODE
+# define SQL_ACCESS_MODE                101
+# define SQL_AUTOCOMMIT                 102
+# define SQL_LOGIN_TIMEOUT              103
+# define SQL_OPT_TRACE                  104
+# define SQL_OPT_TRACEFILE              105
+# define SQL_TRANSLATE_DLL              106
+# define SQL_TRANSLATE_OPTION           107
+# define SQL_TXN_ISOLATION              108
+# define SQL_CURRENT_QUALIFIER          109
+# define SQL_ODBC_CURSORS               110
+# define SQL_QUIET_MODE                 111
+# define SQL_PACKET_SIZE                112
+# define SQL_CONN_OPT_MAX               SQL_PACKET_SIZE
+# define SQL_CONNECT_OPT_DRVR_START     1000
+
+# define SQL_CONN_OPT_MIN               SQL_ACCESS_MODE
 
 /* SQL_ACCESS_MODE options */
-# define SQL_MODE_READ_WRITE           0UL
-# define SQL_MODE_READ_ONLY            1UL
-# define SQL_MODE_DEFAULT              SQL_MODE_READ_WRITE
+# define SQL_MODE_READ_WRITE            0UL
+# define SQL_MODE_READ_ONLY             1UL
+# define SQL_MODE_DEFAULT               SQL_MODE_READ_WRITE
 
 /* SQL_AUTOCOMMIT options */
-# define SQL_AUTOCOMMIT_OFF            0UL
-# define SQL_AUTOCOMMIT_ON             1UL
-# define SQL_AUTOCOMMIT_DEFAULT                SQL_AUTOCOMMIT_ON
+# define SQL_AUTOCOMMIT_OFF             0UL
+# define SQL_AUTOCOMMIT_ON              1UL
+# define SQL_AUTOCOMMIT_DEFAULT         SQL_AUTOCOMMIT_ON
 
 /* SQL_LOGIN_TIMEOUT options */
-# define SQL_LOGIN_TIMEOUT_DEFAULT     15UL
+# define SQL_LOGIN_TIMEOUT_DEFAULT      15UL
 
 /* SQL_OPT_TRACE options */
-# define SQL_OPT_TRACE_OFF             0UL
-# define SQL_OPT_TRACE_ON              1UL
-# define SQL_OPT_TRACE_DEFAULT         SQL_OPT_TRACE_OFF
-# define SQL_OPT_TRACE_FILE_DEFAULT    "odbc.log"
+# define SQL_OPT_TRACE_OFF              0UL
+# define SQL_OPT_TRACE_ON               1UL
+# define SQL_OPT_TRACE_DEFAULT          SQL_OPT_TRACE_OFF
+# define SQL_OPT_TRACE_FILE_DEFAULT     "odbc.log"
 
 /* SQL_ODBC_CURSORS options */
-# define SQL_CUR_USE_IF_NEEDED         0UL
-# define SQL_CUR_USE_ODBC              1UL
-# define SQL_CUR_USE_DRIVER            2UL
-# define SQL_CUR_DEFAULT               SQL_CUR_USE_DRIVER
+# define SQL_CUR_USE_IF_NEEDED          0UL
+# define SQL_CUR_USE_ODBC               1UL
+# define SQL_CUR_USE_DRIVER             2UL
+# define SQL_CUR_DEFAULT                SQL_CUR_USE_DRIVER
 
 /* Column types and scopes in SQLSpecialColumns. */
-# define SQL_BEST_ROWID                        1
-# define SQL_ROWVER                    2
+# define SQL_BEST_ROWID                 1
+# define SQL_ROWVER                     2
 
-# define SQL_SCOPE_CURROW              0
-# define SQL_SCOPE_TRANSACTION         1
-# define SQL_SCOPE_SESSION             2
+# define SQL_SCOPE_CURROW               0
+# define SQL_SCOPE_TRANSACTION          1
+# define SQL_SCOPE_SESSION              2
 
 /* Operations in SQLSetPos */
-# define SQL_ADD                       4
+# define SQL_ADD                        4
 
 /* Lock options in SQLSetPos */
-# define SQL_LOCK_NO_CHANGE            0       
-# define SQL_LOCK_EXCLUSIVE            1               
-# define SQL_LOCK_UNLOCK               2
+# define SQL_LOCK_NO_CHANGE             0
+# define SQL_LOCK_EXCLUSIVE             1
+# define SQL_LOCK_UNLOCK                2
 
 /* SQLExtendedFetch flag values */
-# define SQL_FETCH_NEXT                        1
-# define SQL_FETCH_FIRST               2
-# define SQL_FETCH_LAST                        3
-# define SQL_FETCH_PRIOR               4
-# define SQL_FETCH_ABSOLUTE            5
-# define SQL_FETCH_RELATIVE            6
-# define SQL_FETCH_BOOKMARK            8
+# define SQL_FETCH_NEXT                 1
+# define SQL_FETCH_FIRST                2
+# define SQL_FETCH_LAST                 3
+# define SQL_FETCH_PRIOR                4
+# define SQL_FETCH_ABSOLUTE             5
+# define SQL_FETCH_RELATIVE             6
+# define SQL_FETCH_BOOKMARK             8
 
 /* Defines for SQLBindParameter/SQLProcedureColumns */
-# define SQL_PARAM_TYPE_UNKNOWN                0
-# define SQL_PARAM_INPUT               1
-# define SQL_PARAM_INPUT_OUTPUT                2
-# define SQL_RESULT_COL                        3
-# define SQL_PARAM_OUTPUT              4
+# define SQL_PARAM_TYPE_UNKNOWN         0
+# define SQL_PARAM_INPUT                1
+# define SQL_PARAM_INPUT_OUTPUT         2
+# define SQL_RESULT_COL                 3
+# define SQL_PARAM_OUTPUT               4
 
 /* Defines used by Driver Manager for mapping SQLSetParam to SQLBindParameter */
-# define SQL_PARAM_TYPE_DEFAULT                SQL_PARAM_INPUT_OUTPUT
-# define SQL_SETPARAM_VALUE_MAX                (-1L)
+# define SQL_PARAM_TYPE_DEFAULT         SQL_PARAM_INPUT_OUTPUT
+# define SQL_SETPARAM_VALUE_MAX         (-1L)
 
 /* SQLStatistics flag values */
-# define SQL_INDEX_UNIQUE              0
-# define SQL_INDEX_ALL                 1
+# define SQL_INDEX_UNIQUE               0
+# define SQL_INDEX_ALL                  1
 
-# define SQL_QUICK                     0
-# define SQL_ENSURE                    1
+# define SQL_QUICK                      0
+# define SQL_ENSURE                     1
 
 /* SQLSetScrollOption flag values */
-# define SQL_SCROLL_FORWARD_ONLY       0L
-# define SQL_SCROLL_KEYSET_DRIVEN      (-1L)
-# define SQL_SCROLL_DYNAMIC            (-2L)
-# define SQL_SCROLL_STATIC             (-3L) 
+# define SQL_SCROLL_FORWARD_ONLY        0L
+# define SQL_SCROLL_KEYSET_DRIVEN       (-1L)
+# define SQL_SCROLL_DYNAMIC             (-2L)
+# define SQL_SCROLL_STATIC              (-3L)
 
-# ifdef __cplusplus
-       extern  "C" {
+# if defined(__cplusplus) || defined(__IBMCPP__)
+        extern  "C" {
 # endif
 
 RETCODE SQL_API SQLSetConnectOption (HDBC, UWORD, UDWORD);
 RETCODE SQL_API SQLNumResultCols ( HSTMT, SWORD FAR* );
 
-# ifdef __cplusplus
-       }
+# if defined(__cplusplus) || defined(__IBMCPP__)
+        }
 # endif
 
 #endif
index 106d7a38043d75a8e282381391dd33421742769f..ae164808a5ede42c13dd1ad5f8ad7c9be333e7e6 100644 (file)
@@ -1,6 +1,6 @@
 /** trace functions
-       
-    Copyright (C) 1995 by Ke Jin <kejin@empress.com> 
+
+    Copyright (C) 1995 by Ke Jin <kejin@empress.com>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 
 static  int printreturn(void FAR* istm, int ret )
 {
-       FILE FAR*       stm = (FILE FAR*)istm;
-       char FAR*       ptr = "Invalid return value";
-
-       switch( ret )
-       {
-               case SQL_SUCCESS:
-                       ptr = "SQL_SUCCESS";
-                       break;
-               
-               case SQL_SUCCESS_WITH_INFO:
-                       ptr = "SQL_SUCCESS_WITH_INFO";
-                       break;
-
-               case SQL_NO_DATA_FOUND:
-                       ptr = "SQL_NO_DATA_FOUND";
-                       break;
-
-               case SQL_NEED_DATA:
-                       ptr = "SQL_NEED_DATA";
-                       break;
-
-               case SQL_INVALID_HANDLE:
-                       ptr = "SQL_INVALID_HANDLE";
-                       break;
-
-               case SQL_ERROR:
-                       ptr = "SQL_ERROR";
-                       break;
-
-               case SQL_STILL_EXECUTING:
-                       ptr = "SQL_STILL_EXECUTING";
-                       break;
-
-               default:
-                       break;
-       }
-
-       fprintf( stm, "%s\n", ptr);
-       fflush( stm );
-
-       return 0;
+        FILE FAR*       stm = (FILE FAR*)istm;
+        char FAR*       ptr = "Invalid return value";
+
+        switch( ret )
+        {
+                case SQL_SUCCESS:
+                        ptr = "SQL_SUCCESS";
+                        break;
+
+                case SQL_SUCCESS_WITH_INFO:
+                        ptr = "SQL_SUCCESS_WITH_INFO";
+                        break;
+
+                case SQL_NO_DATA_FOUND:
+                        ptr = "SQL_NO_DATA_FOUND";
+                        break;
+
+                case SQL_NEED_DATA:
+                        ptr = "SQL_NEED_DATA";
+                        break;
+
+                case SQL_INVALID_HANDLE:
+                        ptr = "SQL_INVALID_HANDLE";
+                        break;
+
+                case SQL_ERROR:
+                        ptr = "SQL_ERROR";
+                        break;
+
+                case SQL_STILL_EXECUTING:
+                        ptr = "SQL_STILL_EXECUTING";
+                        break;
+
+                default:
+                        break;
+        }
+
+        fprintf( stm, "%s\n", ptr);
+        fflush( stm );
+
+        return 0;
 }
 
-HPROC  _iodbcdm_gettrproc(void FAR* istm, int procid, int type)
+HPROC   _iodbcdm_gettrproc(void FAR* istm, int procid, int type)
 {
-       FILE FAR*       stm = (FILE FAR*)istm;
+        FILE FAR*       stm = (FILE FAR*)istm;
 
-       if( type == TRACE_TYPE_DM2DRV )
-       {
-               int i,j = 0;
+        if( type == TRACE_TYPE_DM2DRV )
+        {
+                int i,j = 0;
 
-               for(i=0;j != en_NullProc ;i++)
-               {
-                       j = odbcapi_symtab[i].en_idx;
+                for(i=0;j != en_NullProc ;i++)
+                {
+                        j = odbcapi_symtab[i].en_idx;
 
-                       if( j == procid )
-                       {
-                               fprintf( stm, "\n%s ( ... )\n",
-                                       odbcapi_symtab[i].symbol);
+                        if( j == procid )
+                        {
+                                fprintf( stm, "\n%s ( ... )\n",
+                                        odbcapi_symtab[i].symbol);
 
-                               fflush( stm );
-                       }
-               }
-       }
+                                fflush( stm );
+                        }
+                }
+        }
 
-       if( type == TRACE_TYPE_RETURN )
-       {
-               return (HPROC)printreturn;
-       }
+        if( type == TRACE_TYPE_RETURN )
+        {
+                return (HPROC)printreturn;
+        }
 
-       return SQL_NULL_HPROC;
+        return SQL_NULL_HPROC;
 }
index 6b4e850cbaea00b84da02ed611104557c50e6416..f932dcc746e2fe5f1c64f647cca524ca918cf728 100644 (file)
@@ -1,97 +1,97 @@
-#ifndef        _ITRACE_H
+#ifndef _ITRACE_H
 # define _ITRACE_H
 
-# ifdef        DEBUG
+# ifdef DEBUG
 #  ifndef NO_TRACE
 #   define NO_TRACE
 #  endif
 # endif
 
-# define TRACE_TYPE_APP2DM     1
-# define TRACE_TYPE_DM2DRV     2
-# define TRACE_TYPE_DRV2DM     3
+# define TRACE_TYPE_APP2DM      1
+# define TRACE_TYPE_DM2DRV      2
+# define TRACE_TYPE_DRV2DM      3
 
-# define TRACE_TYPE_RETURN     4
+# define TRACE_TYPE_RETURN      4
 
-extern HPROC   _iodbcdm_gettrproc(void FAR* stm, int procid, int type);
+extern HPROC    _iodbcdm_gettrproc(void FAR* stm, int procid, int type);
 
 # ifdef NO_TRACE
-#  define TRACE_CALL( stm, trace_on, procid, plist )   
+#  define TRACE_CALL( stm, trace_on, procid, plist )
 # else
 #  define TRACE_CALL( stm, trace_on, plist )\
-       {\
-               if( trace_on)\
-               {\
-                       HPROC   hproc;\
+        {\
+                if( trace_on)\
+                {\
+                        HPROC   hproc;\
 \
-                       hproc = _iodbcdm_gettrproc(stm, procid, TRACE_TYPE_APP2DM);\
+                        hproc = _iodbcdm_gettrproc(stm, procid, TRACE_TYPE_APP2DM);\
 \
-                       if( hproc )\
-                               hproc plist;\
-               }\
-       }
+                        if( hproc )\
+                                hproc plist;\
+                }\
+        }
 # endif
 
 # ifdef NO_TRACE
 #  define TRACE_DM2DRV( stm, procid, plist )
 # else
 #  define TRACE_DM2DRV( stm, procid, plist )\
-       {\
-               HPROC   hproc;\
+        {\
+                HPROC   hproc;\
 \
-               hproc = _iodbcdm_gettrproc(stm, procid, TRACE_TYPE_DM2DRV);\
+                hproc = _iodbcdm_gettrproc(stm, procid, TRACE_TYPE_DM2DRV);\
 \
-               if( hproc )\
-                       hproc plist;\
-       }
+                if( hproc )\
+                        hproc plist;\
+        }
 # endif
 
 # ifdef NO_TRACE
 #  define TRACE_DRV2DM( stm, procid, plist )
 # else
 #  define TRACE_DRV2DM( stm, procid, plist ) \
-       {\
-               HPROC   hproc;\
+        {\
+                HPROC   hproc;\
 \
-               hproc = _iodbcdm_gettrproc( stm, procid, TRACE_TYPE_DRV2DM);\
+                hproc = _iodbcdm_gettrproc( stm, procid, TRACE_TYPE_DRV2DM);\
 \
-               if( hproc )\
-                               hproc plist;\
-       }
+                if( hproc )\
+                                hproc plist;\
+        }
 # endif
 
 # ifdef NO_TRACE
 #  define TRACE_RETURN( stm, trace_on, ret )
 # else
 #  define TRACE_RETURN( stm, trace_on, ret )\
-       {\
-               if( trace_on ) {\
-                       HPROC hproc;\
+        {\
+                if( trace_on ) {\
+                        HPROC hproc;\
 \
-                       hproc = _iodbcdm_gettrproc( stm, 0, TRACE_TYPE_RETURN);\
+                        hproc = _iodbcdm_gettrproc( stm, 0, TRACE_TYPE_RETURN);\
 \
-                       if( hproc )\
-                               hproc( stm, ret );\
-               }\
-       }
+                        if( hproc )\
+                                hproc( stm, ret );\
+                }\
+        }
 # endif
 
-# ifdef        NO_TRACE 
-#  define CALL_DRIVER( hdbc, ret, proc, procid, plist )        { ret = proc plist; }
+# ifdef NO_TRACE
+#  define CALL_DRIVER( hdbc, ret, proc, procid, plist ) { ret = proc plist; }
 # else
 #  define CALL_DRIVER( hdbc, ret, proc, procid, plist )\
-       {\
-               DBC_t FAR*      pdbc = (DBC_t FAR*)(hdbc);\
+        {\
+                DBC_t FAR*      pdbc = (DBC_t FAR*)(hdbc);\
 \
-               if( pdbc->trace ) {\
-                       TRACE_DM2DRV( pdbc->tstm, procid, plist )\
-                       ret = proc plist;\
-                       TRACE_DRV2DM( pdbc->tstm, procid, plist )\
-                       TRACE_RETURN( pdbc->tstm, 1, ret )\
-               }\
-               else\
-                       ret = proc plist;\
-       }
+                if( pdbc->trace ) {\
+                        TRACE_DM2DRV( pdbc->tstm, procid, plist )\
+                        ret = proc plist;\
+                        TRACE_DRV2DM( pdbc->tstm, procid, plist )\
+                        TRACE_RETURN( pdbc->tstm, 1, ret )\
+                }\
+                else\
+                        ret = proc plist;\
+        }
 # endif
 
 #endif
index d6062de7c06a066aee2a50039434a8d644734d6d..8addc3ced683f91679bd3b35d47355cd9f07e9f3 100644 (file)
@@ -1,7 +1,7 @@
-#include       <iodbc.h>
+#include        <config.h>
 
 /* entry function used to build a share library on AIX  */
-int    __start()
+int     __start()
 {
-       return 0;
+        return 0;
 }
index 4793645a1290e6f01615da45ce6d503b55153718..42b26a62b92a1b7fea43cafaa9eccaba190f8df7 100644 (file)
@@ -1,6 +1,6 @@
 /** miscellaneous functions
-       
-    Copyright (C) 1995 by Ke Jin <kejin@empress.com> 
+
+    Copyright (C) 1995 by Ke Jin <kejin@empress.com>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     GNU General Public License for more details.
 **/
 
+#ifdef DLDAPI_OS2
+#  define INCL_DOSMODULEMGR                 /* Module Manager values */
+#  define INCL_DOSERRORS                    /* Error values          */
+#  include      <os2.h>
+#  include      <stdio.h>
+#endif
+
 #include       <../iodbc/iodbc.h>
 
 #include       <../iodbc/isql.h>
 #include       <stdio.h>
 #include        <strings.h>
 
-static int     
-upper_strneq( 
-       char*   s1,
-       char*   s2,
-       int     n )
+#include        <unistd.h>
+
+
+static int
+upper_strneq(
+        char*   s1,
+        char*   s2,
+        int     n )
 {
-       int     i; 
-       char    c1 = 0, c2 = 0;
-
-       for(i=1;i<n;i++)
-       {
-               c1 = s1[i];
-               c2 = s2[i];
-
-               if( c1 >= 'a' && c1 <= 'z' )
-               {
-                       c1 += ('A' - 'a');
-               }
-               else if( c1 == '\n' )
-               {
-                       c1 = '\0';
-               }
-
-               if( c2 >= 'a' && c2 <= 'z' )
-               {
-                       c2 += ('A' - 'a');
-               }
-               else if( c2 == '\n' )
-               {
-                       c2 = '\0';
-               }
-
-               if( (c1 - c2) || !c1 || !c2 )
-               {
-                       break;
-               }
-       }
-
-       return (int)!(c1 - c2);
+        int     i;
+        char    c1, c2;
+
+        for(i=1;i<n;i++)
+        {
+                c1 = s1[i];
+                c2 = s2[i];
+
+                if( c1 >= 'a' && c1 <= 'z' )
+                {
+                        c1 += ('A' - 'a');
+                }
+                else if( c1 == '\n' )
+                {
+                        c1 = '\0';
+                }
+
+                if( c2 >= 'a' && c2 <= 'z' )
+                {
+                        c2 += ('A' - 'a');
+                }
+                else if( c2 == '\n' )
+                {
+                        c2 = '\0';
+                }
+
+                if( (c1 - c2) || !c1 || !c2 )
+                {
+                        break;
+                }
+        }
+
+        return (int)!(c1 - c2);
 }
 
-static char*                   /* return new position in input str */
-readtoken( 
-       char*   istr,           /* old position in input buf */
-       char*   obuf )          /* token string ( if "\0", then finished ) */
+static char*                    /* return new position in input str */
+readtoken(
+        char*   istr,           /* old position in input buf */
+        char*   obuf )          /* token string ( if "\0", then finished ) */
 {
-       for(; *istr && *istr != '\n' ; istr ++ )
-       {
-               char c, nx;
+        for(; *istr && *istr != '\n' ; istr ++ )
+        {
+                char c, nx;
 
-               c = *(istr);
+                c = *(istr);
 
-               if( c == ' ' || c == '\t' )
-               {
-                       continue;
-               }
+                if( c == ' ' || c == '\t' )
+                {
+                        continue;
+                }
 
-               nx = *(istr + 1);
+                nx = *(istr + 1);
 
-               *obuf = c;
-               obuf ++;
+                *obuf = c;
+                obuf ++;
 
-               if( c == ';' || c == '=' )
-               {
-                       istr ++;
-                       break;
-               }
+                if( c == ';' || c == '=' )
+                {
+                        istr ++;
+                        break;
+                }
 
-               if( nx == ' ' || nx == '\t' || nx == ';' || nx == '=' )
-               {
-                       istr ++;
-                       break;
-               }
-       }
+                if( nx == ' ' || nx == '\t' || nx == ';' || nx == '=' )
+                {
+                        istr ++;
+                        break;
+                }
+        }
 
-       *obuf = '\0'; 
+        *obuf = '\0';
 
-       return istr;
+        return istr;
 }
 
-#if    !defined(WINDOWS) && !defined(WIN32) && !defined(OS2)
-# include      <pwd.h>
-# define       UNIX_PWD
+#if     !defined(WINDOWS) && !defined(WIN32) && !defined(OS2)
+# include       <pwd.h>
+# define        UNIX_PWD
 #endif
 
 static char*
-getinitfile(char* buf, int size)       
+getinitfile(char* buf, int size)
 {
-       int     /* i, */ j;
-       char*   ptr;
-
-       j = STRLEN("/odbc.ini") + 1;
-
-       if( size < j )
-       {
-               return NULL;
-       }
+        int     i, j;
+        char*   ptr;
 
-#if    !defined(UNIX_PWD)
-       
-       i = GetWindowsDirectory((LPSTR)buf, size );
+        j = STRLEN("/iodbc.ini") + 1;
 
-       if( i == 0 || i > size - j )
-       {
-               return NULL;
-       }
+        if( size < j )
+        {
+                return NULL;
+        }
 
-       sprintf( buf + i, "/odbc.ini");
-
-       return buf;
+#ifdef FIX_INI_FILE
+        sprintf( buf, "%s/iodbc.ini", DIR_INI_FILE );
 #else
-       ptr = (char*)getpwuid(getuid());        
-
-       if( ptr == NULL )
-       {
-               return NULL;
-       }
-
-       ptr = ((struct passwd*)ptr)->pw_dir;
-
-       if( ptr == NULL || *ptr == '\0' )
-       {
-               ptr = "/home";
-       }
-
-       if( size < STRLEN(ptr) + j )
-       {
-               return NULL;
-       }
-
-       sprintf( buf, "%s%s", ptr, "/.odbc.ini");
-       /* i.e. searching ~/.odbc.ini */ 
+#  ifdef OS2
+        *buf = '\0';
+        if( NULL != getenv("IODBC_INI") )
+        {
+                strcpy( buf, getenv("IODBC_INI") );
+        }
+        else
+        {
+                HMODULE         hModule;
+
+                if( NO_ERROR == DosQueryModuleHandle(DLL_NAME, &hModule) &&
+                    NO_ERROR == DosQueryModuleName(hModule, 256L, buf) )
+                {
+                        if( NULL != strrchr(buf, '.') )
+                                *(strchr(buf, '.')) = '\0';
+                        strcat( buf, ".ini" );
+                }
+                else
+                {
+                        strcpy( buf, "iodbc.ini" );
+                }
+
+        }
+        return buf;
+#  else
+#    if   !defined(UNIX_PWD)
+
+        i = GetWindowsDirectory((LPSTR)buf, size );
+
+        if( i == 0 || i > size - j )
+        {
+                return NULL;
+        }
+
+        sprintf( buf + i, "/iodbc.ini");
+
+        return buf;
+#    else
+        ptr = (char*)getpwuid(getuid());
+
+        if( ptr == NULL )
+        {
+                return NULL;
+        }
+
+        ptr = ((struct passwd*)ptr)->pw_dir;
+
+        if( ptr == NULL || *ptr == '\0' )
+        {
+                ptr = "/home";
+        }
+
+        if( size < STRLEN(ptr) + j )
+        {
+                return NULL;
+        }
+
+        sprintf( buf, "%s%s", ptr, "/.iodbc.ini");
+        /* i.e. searching ~/.iodbc.ini */
+#    endif
+#  endif
 #endif
 
-       return buf;
+        return buf;
 }
 
-char*  _iodbcdm_getkeyvalbydsn(
-               char*   dsn,            
-               int     dsnlen, 
-               char*   keywd, 
-               char*   value, 
-               int     size )
+char*   _iodbcdm_getkeyvalbydsn(
+                char*   dsn,
+                int     dsnlen,
+                char*   keywd,
+                char*   value,
+                int     size )
 /* read odbc init file to resolve the value of specified
- * key from named or defaulted dsn section 
+ * key from named or defaulted dsn section
  */
 {
-       char    buf[1024];
-       char    dsntk[SQL_MAX_DSN_LENGTH + 3] = { '[', '\0'  };
-       char    token[1024];    /* large enough */
-       FILE*   file;
-       char    pathbuf[1024];
-       char*   path;
-
-#define DSN_NOMATCH    0       
-#define DSN_NAMED      1
-#define DSN_DEFAULT    2
-
-       int     dsnid = DSN_NOMATCH;
-       int     defaultdsn = DSN_NOMATCH;
-
-       if( dsn == NULL || *dsn == 0 )
-       {
-               dsn = "default";
-               dsnlen = STRLEN(dsn);
-       }
-
-       if( dsnlen == SQL_NTS )
-       {
-               dsnlen = STRLEN(dsn);
-       }
-
-       if( dsnlen <= 0 || keywd == NULL || buf == 0 || size <= 0 )
-       {
-               return NULL;
-       }
-
-       if( dsnlen > sizeof(dsntk) - 2  )
-       {
-               return NULL;
-       }
-
-       value[0] = '\0';
-
-       STRNCAT( dsntk, dsn, dsnlen );
-       STRCAT( dsntk, "]" );
-
-       dsnlen = dsnlen + 2;
-
-       path = getinitfile(pathbuf, sizeof(pathbuf));
-
-       if( path == NULL )
-       {
-               return NULL;
-       }
-
-       file = (FILE*)fopen(path, "r");
-
-       if( file == NULL )
-       {
-               return NULL;
-       }
-
-       for(;;)
-       {
-               char*   str;
-
-               str = fgets(buf, sizeof(buf), file);
-
-               if( str == NULL )
-               {
-                       break;
-               }
-
-               if( *str == '[' )
-               {
-                       if( upper_strneq(str, "[default]", STRLEN("[default]")) )
-                       {
-                               /* we only read first dsn default dsn
-                                * section (as well as named dsn).
-                                */
-                               if( defaultdsn == DSN_NOMATCH )
-                               {
-                                       dsnid = DSN_DEFAULT;
-                                       defaultdsn = DSN_DEFAULT;
-                               }
-                               else
-                               {
-                                       dsnid = DSN_NOMATCH;
-                               }
-
-                               continue;
-                       }
-                       else if( upper_strneq( str, dsntk, dsnlen ) )
-                       {
-                               dsnid = DSN_NAMED;
-                       }
-                       else
-                       {
-                               dsnid = DSN_NOMATCH;
-                       }
-
-                       continue;
-               }
-               else if( dsnid == DSN_NOMATCH )
-               {
-                       continue;
-               }
-
-               str = readtoken(str, token);
-
-               if( upper_strneq( keywd, token, STRLEN(keywd)) )
-               {
-                       str = readtoken(str, token);
-
-                       if( ! STREQ( token, "=") )
-                       /* something other than = */
-                       {
-                               continue;
-                       }
-
-                       str = readtoken(str, token);
-
-                       if( STRLEN(token) > size - 1)
-                       {
-                               break;
-                       }
-
-                       STRNCPY(value, token, size);
-                       /* copy the value(i.e. next token) to buf */
-
-                       if( dsnid != DSN_DEFAULT )
-                       {
-                               break;
-                       }
-               }
-       }
-
-       fclose(file);
-
-       return (*value)? value:NULL;
+        char    buf[1024];
+        char    dsntk[SQL_MAX_DSN_LENGTH + 3] = { '[', '\0'  };
+        char    token[1024];    /* large enough */
+        FILE*   file;
+        char    pathbuf[1024];
+        char*   path;
+
+#define DSN_NOMATCH     0
+#define DSN_NAMED       1
+#define DSN_DEFAULT     2
+
+        int     dsnid = DSN_NOMATCH;
+        int     defaultdsn = DSN_NOMATCH;
+
+        if( dsn == NULL || *dsn == 0 )
+        {
+                dsn = "default";
+                dsnlen = STRLEN(dsn);
+        }
+
+        if( dsnlen == SQL_NTS )
+        {
+                dsnlen = STRLEN(dsn);
+        }
+
+        if( dsnlen <= 0 || keywd == NULL || buf == 0 || size <= 0 )
+        {
+                return NULL;
+        }
+
+        if( dsnlen > sizeof(dsntk) - 2  )
+        {
+                return NULL;
+        }
+
+        value[0] = '\0';
+
+        STRNCAT( dsntk, dsn, dsnlen );
+        STRCAT( dsntk, "]" );
+
+        dsnlen = dsnlen + 2;
+
+        path = getinitfile(pathbuf, sizeof(pathbuf));
+
+        if( path == NULL )
+        {
+                return NULL;
+        }
+
+        file = (FILE*)fopen(path, "r");
+
+        if( file == NULL )
+        {
+                return NULL;
+        }
+
+        for(;;)
+        {
+                char*   str;
+
+                str = fgets(buf, sizeof(buf), file);
+
+                if( str == NULL )
+                {
+                        break;
+                }
+
+                strtok( str, "\n\r" );
+
+                if( *str == '[' )
+                {
+                        if( upper_strneq(str, "[default]", STRLEN("[default]")) )
+                        {
+                                /* we only read first dsn default dsn
+                                 * section (as well as named dsn).
+                                 */
+                                if( defaultdsn == DSN_NOMATCH )
+                                {
+                                        dsnid = DSN_DEFAULT;
+                                        defaultdsn = DSN_DEFAULT;
+                                }
+                                else
+                                {
+                                        dsnid = DSN_NOMATCH;
+                                }
+
+                                continue;
+                        }
+                        else if( upper_strneq( str, dsntk, dsnlen ) )
+                        {
+                                dsnid = DSN_NAMED;
+                        }
+                        else
+                        {
+                                dsnid = DSN_NOMATCH;
+                        }
+
+                        continue;
+                }
+                else if( dsnid == DSN_NOMATCH )
+                {
+                        continue;
+                }
+
+                str = readtoken(str, token);
+
+                if( upper_strneq( keywd, token, STRLEN(keywd)) )
+                {
+                        str = readtoken(str, token);
+
+                        if( ! STREQ( token, "=") )
+                        /* something other than = */
+                        {
+                                continue;
+                        }
+
+                        str = readtoken(str, token);
+
+                        if( STRLEN(token) > size - 1)
+                        {
+                                break;
+                        }
+
+                        STRNCPY(value, token, size);
+                        /* copy the value(i.e. next token) to buf */
+
+                        if( dsnid != DSN_DEFAULT )
+                        {
+                                break;
+                        }
+                }
+        }
+
+        fclose(file);
+
+        return (*value)? value:NULL;
 }
 
-char*  _iodbcdm_getkeyvalinstr( 
-               char*   cnstr, 
-               int     cnlen, 
-               char*   keywd,
-               char*   value,
-               int     size )
+char*   _iodbcdm_getkeyvalinstr(
+                char*   cnstr,
+                int     cnlen,
+                char*   keywd,
+                char*   value,
+                int     size )
 {
-       char    token[1024] = { '\0' };
-       int     flag = 0;
-
-       if( cnstr == NULL || value == NULL
-        || keywd == NULL || size < 1 )
-       {
-               return NULL;
-       }
-
-       if( cnlen == SQL_NTS )
-       {
-               cnlen = STRLEN (cnstr);
-       }
-
-       if( cnlen <= 0 )
-       {
-               return NULL;
-       }
-
-       for(;;)
-       {
-               cnstr = readtoken(cnstr, token);
-
-               if( *token == '\0' )
-               {
-                       break;
-               }
-
-               if( STREQ( token, ";" ) )
-               {
-                       flag = 0; 
-                       continue;
-               }
-
-               switch(flag)
-               {
-                       case 0:
-                               if( upper_strneq(token, keywd, strlen(keywd)) )
-                               {
-                                       flag = 1;
-                               }
-                               break;
-
-                       case 1:
-                               if( STREQ( token, "=" ) )
-                               {
-                                       flag = 2;
-                               }
-                               break;
-
-                       case 2:
-                               if( size < strlen(token) + 1 )
-                               {
-                                       return NULL;
-                               }
-
-                               STRNCPY( value, token, size );
-
-                               return value;
-
-                       default:
-                               break;
-               }
-       }
-
-       return  NULL;
+        char    token[1024] = { '\0' };
+        int     flag = 0;
+
+        if( cnstr == NULL || value == NULL
+         || keywd == NULL || size < 1 )
+        {
+                return NULL;
+        }
+
+        if( cnlen == SQL_NTS )
+        {
+                cnlen = STRLEN (cnstr);
+        }
+
+        if( cnlen <= 0 )
+        {
+                return NULL;
+        }
+
+        for(;;)
+        {
+                cnstr = readtoken(cnstr, token);
+
+                if( *token == '\0' )
+                {
+                        break;
+                }
+
+                if( STREQ( token, ";" ) )
+                {
+                        flag = 0;
+                        continue;
+                }
+
+                switch(flag)
+                {
+                        case 0:
+                                if( upper_strneq(token, keywd, strlen(keywd)) )
+                                {
+                                        flag = 1;
+                                }
+                                break;
+
+                        case 1:
+                                if( STREQ( token, "=" ) )
+                                {
+                                        flag = 2;
+                                }
+                                break;
+
+                        case 2:
+                                if( size < strlen(token) + 1 )
+                                {
+                                        return NULL;
+                                }
+
+                                STRNCPY( value, token, size );
+
+                                return value;
+
+                        default:
+                                break;
+                }
+        }
+
+        return  NULL;
 }
diff --git a/src/iodbc/odbc_funcs.h b/src/iodbc/odbc_funcs.h
new file mode 100644 (file)
index 0000000..508d5bd
--- /dev/null
@@ -0,0 +1,380 @@
+#define SQLRETURN RETCODE
+SQLRETURN SQL_API SQLDriverConnect(
+    SQLHDBC            hdbc,
+    SQLHWND            hwnd,
+    SQLCHAR FAR       *szConnStrIn,
+    SQLSMALLINT        cbConnStrIn,
+    SQLCHAR FAR       *szConnStrOut,
+    SQLSMALLINT        cbConnStrOutMax,
+    SQLSMALLINT FAR   *pcbConnStrOut,
+    SQLUSMALLINT       fDriverCompletion);
+
+SQLRETURN SQL_API SQLBrowseConnect(
+    SQLHDBC            hdbc,
+    SQLCHAR FAR       *szConnStrIn,
+    SQLSMALLINT        cbConnStrIn,
+    SQLCHAR FAR       *szConnStrOut,
+    SQLSMALLINT        cbConnStrOutMax,
+    SQLSMALLINT FAR   *pcbConnStrOut);
+
+SQLRETURN SQL_API SQLColumnPrivileges(
+    SQLHSTMT           hstmt,
+    SQLCHAR FAR       *szCatalogName,
+    SQLSMALLINT        cbCatalogName,
+    SQLCHAR FAR       *szSchemaName,
+    SQLSMALLINT        cbSchemaName,
+    SQLCHAR FAR       *szTableName,
+    SQLSMALLINT        cbTableName,
+    SQLCHAR FAR       *szColumnName,
+    SQLSMALLINT        cbColumnName);
+
+SQLRETURN SQL_API SQLDescribeParam(
+    SQLHSTMT           hstmt,
+    SQLUSMALLINT       ipar,
+    SQLSMALLINT FAR   *pfSqlType,
+    SQLUINTEGER FAR   *pcbParamDef,
+    SQLSMALLINT FAR   *pibScale,
+    SQLSMALLINT FAR   *pfNullable);
+
+SQLRETURN SQL_API SQLExtendedFetch(
+    SQLHSTMT           hstmt,
+    SQLUSMALLINT       fFetchType,
+    SQLINTEGER         irow,
+    SQLUINTEGER FAR   *pcrow,
+    SQLUSMALLINT FAR  *rgfRowStatus);
+
+SQLRETURN SQL_API SQLForeignKeys(
+    SQLHSTMT           hstmt,
+    SQLCHAR FAR       *szPkCatalogName,
+    SQLSMALLINT        cbPkCatalogName,
+    SQLCHAR FAR       *szPkSchemaName,
+    SQLSMALLINT        cbPkSchemaName,
+    SQLCHAR FAR       *szPkTableName,
+    SQLSMALLINT        cbPkTableName,
+    SQLCHAR FAR       *szFkCatalogName,
+    SQLSMALLINT        cbFkCatalogName,
+    SQLCHAR FAR       *szFkSchemaName,
+    SQLSMALLINT        cbFkSchemaName,
+    SQLCHAR FAR       *szFkTableName,
+    SQLSMALLINT        cbFkTableName);
+
+SQLRETURN SQL_API SQLMoreResults(
+    SQLHSTMT           hstmt);
+
+SQLRETURN SQL_API SQLNativeSql(
+    SQLHDBC            hdbc,
+    SQLCHAR FAR       *szSqlStrIn,
+    SQLINTEGER         cbSqlStrIn,
+    SQLCHAR FAR       *szSqlStr,
+    SQLINTEGER         cbSqlStrMax,
+    SQLINTEGER FAR    *pcbSqlStr);
+
+SQLRETURN SQL_API SQLNumParams(
+    SQLHSTMT           hstmt,
+    SQLSMALLINT FAR   *pcpar);
+
+SQLRETURN SQL_API SQLParamOptions(
+    SQLHSTMT           hstmt,
+    SQLUINTEGER        crow,
+    SQLUINTEGER FAR   *pirow);
+
+SQLRETURN SQL_API SQLPrimaryKeys(
+    SQLHSTMT           hstmt,
+    SQLCHAR FAR       *szCatalogName,
+    SQLSMALLINT        cbCatalogName,
+    SQLCHAR FAR       *szSchemaName,
+    SQLSMALLINT        cbSchemaName,
+    SQLCHAR FAR       *szTableName,
+    SQLSMALLINT        cbTableName);
+
+SQLRETURN SQL_API SQLProcedureColumns(
+    SQLHSTMT           hstmt,
+    SQLCHAR FAR       *szCatalogName,
+    SQLSMALLINT        cbCatalogName,
+    SQLCHAR FAR       *szSchemaName,
+    SQLSMALLINT        cbSchemaName,
+    SQLCHAR FAR       *szProcName,
+    SQLSMALLINT        cbProcName,
+    SQLCHAR FAR       *szColumnName,
+    SQLSMALLINT        cbColumnName);
+
+SQLRETURN SQL_API SQLProcedures(
+    SQLHSTMT           hstmt,
+    SQLCHAR FAR       *szCatalogName,
+    SQLSMALLINT        cbCatalogName,
+    SQLCHAR FAR       *szSchemaName,
+    SQLSMALLINT        cbSchemaName,
+    SQLCHAR FAR       *szProcName,
+    SQLSMALLINT        cbProcName);
+
+SQLRETURN SQL_API SQLSetPos(
+    SQLHSTMT           hstmt,
+    SQLUSMALLINT       irow,
+    SQLUSMALLINT       fOption,
+    SQLUSMALLINT       fLock);
+
+SQLRETURN SQL_API SQLTablePrivileges(
+    SQLHSTMT           hstmt,
+    SQLCHAR FAR       *szCatalogName,
+    SQLSMALLINT        cbCatalogName,
+    SQLCHAR FAR       *szSchemaName,
+    SQLSMALLINT        cbSchemaName,
+    SQLCHAR FAR       *szTableName,
+    SQLSMALLINT        cbTableName);
+
+SQLRETURN SQL_API SQLDrivers(
+    SQLHENV            henv,
+    SQLUSMALLINT       fDirection,
+    SQLCHAR FAR       *szDriverDesc,
+    SQLSMALLINT        cbDriverDescMax,
+    SQLSMALLINT FAR   *pcbDriverDesc,
+    SQLCHAR FAR       *szDriverAttributes,
+    SQLSMALLINT        cbDrvrAttrMax,
+    SQLSMALLINT FAR   *pcbDrvrAttr);
+
+SQLRETURN SQL_API SQLBindParameter(
+    SQLHSTMT           hstmt,
+    SQLUSMALLINT       ipar,
+    SQLSMALLINT        fParamType,
+    SQLSMALLINT        fCType,
+    SQLSMALLINT        fSqlType,
+    SQLUINTEGER        cbColDef,
+    SQLSMALLINT        ibScale,
+    SQLPOINTER         rgbValue,
+    SQLINTEGER         cbValueMax,
+    SQLINTEGER FAR    *pcbValue);
+
+SQLRETURN SQL_API SQLAllocConnect(
+    SQLHENV            henv,
+    SQLHDBC FAR       *phdbc);
+
+SQLRETURN SQL_API SQLAllocEnv(
+    SQLHENV FAR       *phenv);
+
+SQLRETURN SQL_API SQLAllocStmt(
+    SQLHDBC            hdbc,
+    SQLHSTMT FAR      *phstmt);
+
+SQLRETURN SQL_API SQLBindCol(
+    SQLHSTMT           hstmt,
+    SQLUSMALLINT       icol,
+    SQLSMALLINT        fCType,
+    SQLPOINTER         rgbValue,
+    SQLINTEGER         cbValueMax,
+    SQLINTEGER FAR    *pcbValue);
+
+SQLRETURN SQL_API SQLCancel(
+    SQLHSTMT           hstmt);
+
+SQLRETURN SQL_API SQLColAttributes(
+    SQLHSTMT           hstmt,
+    SQLUSMALLINT       icol,
+    SQLUSMALLINT       fDescType,
+    SQLPOINTER         rgbDesc,
+    SQLSMALLINT        cbDescMax,
+    SQLSMALLINT FAR   *pcbDesc,
+    SQLINTEGER FAR    *pfDesc);
+
+SQLRETURN SQL_API SQLConnect(
+    SQLHDBC            hdbc,
+    SQLCHAR FAR       *szDSN,
+    SQLSMALLINT        cbDSN,
+    SQLCHAR FAR       *szUID,
+    SQLSMALLINT        cbUID,
+    SQLCHAR FAR       *szAuthStr,
+    SQLSMALLINT        cbAuthStr);
+
+SQLRETURN SQL_API SQLDescribeCol(
+    SQLHSTMT           hstmt,
+    SQLUSMALLINT       icol,
+    SQLCHAR FAR       *szColName,
+    SQLSMALLINT        cbColNameMax,
+    SQLSMALLINT FAR   *pcbColName,
+    SQLSMALLINT FAR   *pfSqlType,
+    SQLUINTEGER FAR   *pcbColDef,
+    SQLSMALLINT FAR   *pibScale,
+    SQLSMALLINT FAR   *pfNullable);
+
+SQLRETURN SQL_API SQLDisconnect(
+    SQLHDBC            hdbc);
+
+SQLRETURN SQL_API SQLError(
+    SQLHENV            henv,
+    SQLHDBC            hdbc,
+    SQLHSTMT           hstmt,
+    SQLCHAR FAR       *szSqlState,
+    SQLINTEGER FAR    *pfNativeError,
+    SQLCHAR FAR       *szErrorMsg,
+    SQLSMALLINT        cbErrorMsgMax,
+    SQLSMALLINT FAR   *pcbErrorMsg);
+
+SQLRETURN SQL_API SQLExecDirect(
+    SQLHSTMT           hstmt,
+    SQLCHAR FAR       *szSqlStr,
+    SQLINTEGER         cbSqlStr);
+
+SQLRETURN SQL_API SQLExecute(
+    SQLHSTMT           hstmt);
+
+SQLRETURN SQL_API SQLFetch(
+    SQLHSTMT           hstmt);
+
+SQLRETURN SQL_API SQLFreeConnect(
+    SQLHDBC            hdbc);
+
+SQLRETURN SQL_API SQLFreeEnv(
+    SQLHENV            henv);
+
+SQLRETURN SQL_API SQLFreeStmt(
+    SQLHSTMT           hstmt,
+    SQLUSMALLINT       fOption);
+
+SQLRETURN SQL_API SQLGetCursorName(
+    SQLHSTMT           hstmt,
+    SQLCHAR FAR       *szCursor,
+    SQLSMALLINT        cbCursorMax,
+    SQLSMALLINT FAR   *pcbCursor);
+
+SQLRETURN SQL_API SQLNumResultCols(
+    SQLHSTMT           hstmt,
+    SQLSMALLINT FAR   *pccol);
+
+SQLRETURN SQL_API SQLPrepare(
+    SQLHSTMT           hstmt,
+    SQLCHAR FAR       *szSqlStr,
+    SQLINTEGER         cbSqlStr);
+
+SQLRETURN SQL_API SQLRowCount(
+    SQLHSTMT           hstmt,
+    SQLINTEGER FAR    *pcrow);
+
+SQLRETURN SQL_API SQLSetCursorName(
+    SQLHSTMT           hstmt,
+    SQLCHAR FAR       *szCursor,
+    SQLSMALLINT        cbCursor);
+
+SQLRETURN SQL_API SQLTransact(
+    SQLHENV            henv,
+    SQLHDBC            hdbc,
+    SQLUSMALLINT       fType);
+
+
+SQLRETURN SQL_API SQLSetParam(            /*      Use SQLBindParameter */
+    SQLHSTMT           hstmt,
+    SQLUSMALLINT       ipar,
+    SQLSMALLINT        fCType,
+    SQLSMALLINT        fSqlType,
+    SQLUINTEGER        cbParamDef,
+    SQLSMALLINT        ibScale,
+    SQLPOINTER         rgbValue,
+    SQLINTEGER FAR     *pcbValue);
+
+SQLRETURN SQL_API SQLColumns(
+    SQLHSTMT           hstmt,
+    SQLCHAR FAR       *szCatalogName,
+    SQLSMALLINT        cbCatalogName,
+    SQLCHAR FAR       *szSchemaName,
+    SQLSMALLINT        cbSchemaName,
+    SQLCHAR FAR       *szTableName,
+    SQLSMALLINT        cbTableName,
+    SQLCHAR FAR       *szColumnName,
+    SQLSMALLINT        cbColumnName);
+
+SQLRETURN SQL_API SQLGetConnectOption(
+    SQLHDBC            hdbc,
+    SQLUSMALLINT       fOption,
+    SQLPOINTER         pvParam);
+
+SQLRETURN SQL_API SQLGetData(
+    SQLHSTMT           hstmt,
+    SQLUSMALLINT       icol,
+    SQLSMALLINT        fCType,
+    SQLPOINTER         rgbValue,
+    SQLINTEGER         cbValueMax,
+    SQLINTEGER FAR    *pcbValue);
+
+SQLRETURN SQL_API SQLGetFunctions(
+    SQLHDBC            hdbc,
+    SQLUSMALLINT       fFunction,
+    SQLUSMALLINT FAR  *pfExists);
+
+SQLRETURN SQL_API SQLGetInfo(
+    SQLHDBC            hdbc,
+    SQLUSMALLINT       fInfoType,
+    SQLPOINTER         rgbInfoValue,
+    SQLSMALLINT        cbInfoValueMax,
+    SQLSMALLINT FAR   *pcbInfoValue);
+
+SQLRETURN SQL_API SQLGetStmtOption(
+    SQLHSTMT           hstmt,
+    SQLUSMALLINT       fOption,
+    SQLPOINTER         pvParam);
+
+SQLRETURN SQL_API SQLGetTypeInfo(
+    SQLHSTMT           hstmt,
+    SQLSMALLINT        fSqlType);
+
+SQLRETURN SQL_API SQLParamData(
+    SQLHSTMT           hstmt,
+    SQLPOINTER FAR    *prgbValue);
+
+SQLRETURN SQL_API SQLPutData(
+    SQLHSTMT           hstmt,
+    SQLPOINTER         rgbValue,
+    SQLINTEGER         cbValue);
+
+SQLRETURN SQL_API SQLSetConnectOption(
+    SQLHDBC            hdbc,
+    SQLUSMALLINT       fOption,
+    SQLUINTEGER        vParam);
+
+SQLRETURN SQL_API SQLSetStmtOption(
+    SQLHSTMT           hstmt,
+    SQLUSMALLINT       fOption,
+    SQLUINTEGER        vParam);
+
+SQLRETURN SQL_API SQLSpecialColumns(
+    SQLHSTMT           hstmt,
+    SQLUSMALLINT       fColType,
+    SQLCHAR FAR       *szCatalogName,
+    SQLSMALLINT        cbCatalogName,
+    SQLCHAR FAR       *szSchemaName,
+    SQLSMALLINT        cbSchemaName,
+    SQLCHAR FAR       *szTableName,
+    SQLSMALLINT        cbTableName,
+    SQLUSMALLINT       fScope,
+    SQLUSMALLINT       fNullable);
+
+SQLRETURN SQL_API SQLStatistics(
+    SQLHSTMT           hstmt,
+    SQLCHAR FAR       *szCatalogName,
+    SQLSMALLINT        cbCatalogName,
+    SQLCHAR FAR       *szSchemaName,
+    SQLSMALLINT        cbSchemaName,
+    SQLCHAR FAR       *szTableName,
+    SQLSMALLINT        cbTableName,
+    SQLUSMALLINT       fUnique,
+    SQLUSMALLINT       fAccuracy);
+
+SQLRETURN SQL_API SQLTables(
+    SQLHSTMT           hstmt,
+    SQLCHAR FAR       *szCatalogName,
+    SQLSMALLINT        cbCatalogName,
+    SQLCHAR FAR       *szSchemaName,
+    SQLSMALLINT        cbSchemaName,
+    SQLCHAR FAR       *szTableName,
+    SQLSMALLINT        cbTableName,
+    SQLCHAR FAR       *szTableType,
+    SQLSMALLINT        cbTableType);
+
+
+SQLRETURN SQL_API SQLDataSources(
+    SQLHENV            henv,
+    SQLUSMALLINT       fDirection,
+    SQLCHAR FAR       *szDSN,
+    SQLSMALLINT        cbDSNMax,
+    SQLSMALLINT FAR   *pcbDSN,
+    SQLCHAR FAR       *szDescription,
+    SQLSMALLINT        cbDescriptionMax,
+    SQLSMALLINT FAR   *pcbDescription);
+
diff --git a/src/iodbc/odbc_types.h b/src/iodbc/odbc_types.h
new file mode 100644 (file)
index 0000000..b7d78b8
--- /dev/null
@@ -0,0 +1,283 @@
+#define SQL_MAX_USER_NAME_LEN               107
+#define SQL_SPEC_STRING         "02.50"         /* String constant for version */
+#define SQL_ACTIVE_CONNECTIONS               0
+#define SQL_ACTIVE_STATEMENTS                1
+#define SQL_DATA_SOURCE_NAME                 2
+#define SQL_DATABASE_NAME               16    /* Use SQLGetConnectOption/SQL_CURRENT_QUALIFIER */
+#define SQL_DBMS_VER                        18
+#define SQL_FETCH_DIRECTION                  8
+#define SQL_ROW_UPDATES                     11
+#define SQL_ODBC_SAG_CLI_CONFORMANCE        12
+#define SQL_DRIVER_VER                       7
+#define SQL_SERVER_NAME                     13
+#define SQL_SEARCH_PATTERN_ESCAPE           14
+#define SQL_ODBC_API_CONFORMANCE             9
+#define SQL_ODBC_SQL_CONFORMANCE            15
+#define SQL_OAC_LEVEL1                      0x0001
+#define SQL_DBMS_NAME                       17
+#define SQL_ACCESSIBLE_PROCEDURES           20
+#define SQL_OUTER_JOINS                     38
+#define SQL_NEED_LONG_DATA_LEN              111
+#define SQL_EXPRESSIONS_IN_ORDERBY          27
+#define SQL_PROCEDURES                      21
+#define SQL_COLUMN_ALIAS                    87
+#define SQL_CONCAT_NULL_BEHAVIOR            22
+#define SQL_DATA_SOURCE_READ_ONLY           25
+#define SQL_ACCESSIBLE_TABLES               19
+#define SQL_IDENTIFIER_QUOTE_CHAR           29
+#define SQL_MAX_COLUMN_NAME_LEN             30
+#define SQL_MAX_CURSOR_NAME_LEN             31
+#define SQL_MAX_OWNER_NAME_LEN              32
+#define SQL_MAX_PROCEDURE_NAME_LEN          33
+#define SQL_MAX_QUALIFIER_NAME_LEN          34
+#define SQL_MAX_TABLE_NAME_LEN              35
+#define SQL_MULT_RESULT_SETS                36
+#define SQL_MULTIPLE_ACTIVE_TXN             37
+#define SQL_MAX_ROW_SIZE_INCLUDES_LONG      103
+#define SQL_OWNER_TERM                      39
+#define SQL_PROCEDURE_TERM                  40
+#define SQL_QUALIFIER_NAME_SEPARATOR        41
+#define SQL_QUALIFIER_TERM                  42
+#define SQL_SCROLL_CONCURRENCY              43
+#define SQL_SCROLL_OPTIONS                  44
+#define SQL_TABLE_TERM                      45
+#define SQL_TXN_CAPABLE                     46
+#define SQL_USER_NAME                       47
+#define SQL_CONVERT_FUNCTIONS               48
+#define SQL_SYSTEM_FUNCTIONS                51
+#define SQL_NUMERIC_FUNCTIONS               49
+#define SQL_STRING_FUNCTIONS                50
+#define SQL_TIMEDATE_FUNCTIONS              52
+
+#define SQL_CONVERT_BIGINT                  53
+#define SQL_CONVERT_BIT                     55
+#define SQL_CONVERT_CHAR                    56
+#define SQL_CONVERT_DATE                    57
+#define SQL_CONVERT_DECIMAL                 58
+#define SQL_CONVERT_DOUBLE                  59
+#define SQL_CONVERT_FLOAT                   60
+#define SQL_CONVERT_INTEGER                 61
+#define SQL_CONVERT_LONGVARCHAR             62
+#define SQL_CONVERT_NUMERIC                 63
+#define SQL_CONVERT_REAL                    64
+#define SQL_CONVERT_SMALLINT                65
+#define SQL_CONVERT_TIME                    66
+#define SQL_CONVERT_TIMESTAMP               67
+#define SQL_CONVERT_TIMESTAMP               67
+#define SQL_CONVERT_TINYINT                 68
+#define SQL_CONVERT_VARCHAR                 70
+#define SQL_CVT_CHAR                        0x00000001L
+#define SQL_CVT_NUMERIC                     0x00000002L
+#define SQL_CVT_DECIMAL                     0x00000004L
+#define SQL_CVT_INTEGER                     0x00000008L
+#define SQL_CVT_SMALLINT                    0x00000010L
+#define SQL_CVT_FLOAT                       0x00000020L
+#define SQL_CVT_REAL                        0x00000040L
+#define SQL_CVT_DOUBLE                      0x00000080L
+#define SQL_CVT_VARCHAR                     0x00000100L
+#define SQL_CVT_LONGVARCHAR                 0x00000200L
+#define SQL_CVT_BIT                         0x00001000L
+#define SQL_CVT_TINYINT                     0x00002000L
+#define SQL_CVT_BIGINT                      0x00004000L
+#define SQL_CVT_DATE                        0x00008000L
+#define SQL_CVT_TIME                        0x00010000L
+#define SQL_CVT_TIMESTAMP                   0x00020000L
+#define SQL_CVT_TIMESTAMP                   0x00020000L
+#define SQL_CONVERT_BINARY                  54
+#define SQL_CONVERT_VARBINARY               69
+#define SQL_CONVERT_LONGVARBINARY           71
+#define SQL_CORRELATION_NAME                74
+#define SQL_CN_DIFFERENT                    0x0001
+#define SQL_NNC_NON_NULL                    0x0001
+#define SQL_NULL_COLLATION                  85
+#define SQL_NC_START                        0x0002
+#define SQL_MAX_COLUMNS_IN_GROUP_BY         97
+#define SQL_MAX_COLUMNS_IN_ORDER_BY         99
+#define SQL_MAX_COLUMNS_IN_SELECT           100
+#define SQL_MAX_COLUMNS_IN_TABLE            101
+#define SQL_MAX_TABLES_IN_SELECT            106
+#define SQL_MAX_ROW_SIZE_INCLUDES_LONG      103
+#define SQL_MAX_ROW_SIZE                    104
+#define SQL_MAX_BINARY_LITERAL_LEN          112
+#define SQL_MAX_CHAR_LITERAL_LEN            108
+#define SQL_MAX_COLUMNS_IN_INDEX            98
+#define SQL_MAX_INDEX_SIZE                  102
+#define SQL_MAX_STATEMENT_LEN               105
+#define SQL_MAX_OPTION_STRING_LENGTH       256
+
+#define SQL_QL_START                        0x0001L
+#define SQL_SEARCHABLE                  3
+#define SQL_IDENTIFIER_CASE                 28
+#define SQL_COLUMN_NAME                 1
+#define SQL_COLUMN_TYPE                 2
+#define SQL_COLUMN_TYPE_NAME            14
+#define SQL_COLUMN_PRECISION            4
+#define SQL_COLUMN_DISPLAY_SIZE         6
+#define SQL_COLUMN_LENGTH               3
+#define SQL_COLUMN_SCALE                5
+#define SQL_COLUMN_NULLABLE             7
+#define SQL_COLUMN_SEARCHABLE           13
+#define SQL_COLUMN_UNSIGNED             8
+#define SQL_COLUMN_MONEY                9
+#define SQL_COLUMN_AUTO_INCREMENT       11
+#define SQL_COLUMN_CASE_SENSITIVE       12
+#define SQL_COLUMN_UPDATABLE            10
+#define SQL_COLUMN_OWNER_NAME           16
+#define SQL_COLUMN_QUALIFIER_NAME       17
+#define SQL_OSCC_COMPLIANT                  0x0001
+#define SQL_ODBC_SQL_OPT_IEF                73
+#define SQL_LIKE_ESCAPE_CLAUSE              113
+#define SQL_ORDER_BY_COLUMNS_IN_SELECT      90
+#define SQL_POS_OPERATIONS                  79
+#define SQL_POSITIONED_STATEMENTS           80
+#define SQL_LOCK_TYPES                      78
+#define SQL_BOOKMARK_PERSISTENCE            82
+#define SQL_ALTER_TABLE                     86
+#define SQL_OWNER_USAGE                     91
+#define SQL_QUALIFIER_USAGE                 92
+#define SQL_QUOTED_IDENTIFIER_CASE          93
+#define SQL_SUBQUERIES                      95
+#define SQL_UNION                           96
+#define SQL_TIMEDATE_DIFF_INTERVALS         110
+#define SQL_GETDATA_EXTENSIONS              81
+#define SQL_GD_ANY_COLUMN                   0x00000001L
+#define SQL_GD_ANY_ORDER                    0x00000002L
+#define SQL_GD_BOUND                        0x00000008L
+#define SQL_STATIC_SENSITIVITY              83
+#define SQL_SS_DELETIONS                    0x00000002L
+#define SQL_SS_UPDATES                      0x00000004L
+#define SQL_FILE_USAGE                      84
+#define SQL_FILE_NOT_SUPPORTED              0x0000
+#define SQL_GROUP_BY                        88
+#define SQL_GB_GROUP_BY_EQUALS_SELECT       0x0001
+#define SQL_KEYWORDS                        89
+#define SQL_SPECIAL_CHARACTERS              94
+#define SQL_TIMEDATE_ADD_INTERVALS          109
+#define SQL_IC_MIXED                        0x0004
+#define SQL_FN_SYS_DBNAME                   0x00000002L
+#define SQL_FN_SYS_IFNULL                   0x00000004L
+#define SQL_FN_SYS_USERNAME                 0x00000001L
+#define SQL_FN_STR_INSERT                   0x00000002L
+#define SQL_FN_STR_LTRIM                    0x00000008L
+#define SQL_FN_STR_RTRIM                    0x00000400L
+#define SQL_BLOB                          21
+#define SQL_BLOB_LOCATOR                  22
+#define SQL_CLOB                          23
+#define SQL_CLOB_LOCATOR                  24
+#define SQL_DBCLOB                        25
+#define SQL_DBCLOB_LOCATOR                26
+#define SQL_GRAPHIC                       27
+#define SQL_LONGVARGRAPHIC                30
+#define SQL_VARGRAPHIC                    32
+#define SQL_SQLSTATE_SIZE                8
+#define SQL_COLUMN_DISTINCT_TYPE        1250
+#define SQL_COLUMN_TABLE_NAME             15
+#define SQL_LEN_DATA_AT_EXEC_OFFSET  (-100)
+#define SQL_CB_NULL                         0x0000
+#define SQL_TC_NONE                         0x0000
+#define SQL_NOSCAN_OFF                  0UL     
+#define SQL_ASYNC_ENABLE_OFF            0UL
+#define SQL_SC_NON_UNIQUE               0UL
+#define SQL_UB_OFF                      0UL
+#define SQL_PC_NOT_PSEUDO               1
+#define SQL_PC_NON_PSEUDO               SQL_PC_NOT_PSEUDO
+#define SQL_UNSEARCHABLE                0
+#define SQL_FD_FETCH_NEXT                   0x00000001L
+#define SQL_FD_FETCH_FIRST                  0x00000002L
+#define SQL_FD_FETCH_LAST                   0x00000004L
+#define SQL_FD_FETCH_PRIOR                  0x00000008L
+#define SQL_FD_FETCH_PREV               SQL_FD_FETCH_PRIOR
+#define SQL_FD_FETCH_ABSOLUTE               0x00000010L
+#define SQL_FD_FETCH_RELATIVE               0x00000020L
+
+#define SQL_FN_NUM_ABS                      0x00000001L
+#define SQL_FN_NUM_ACOS                     0x00000002L
+#define SQL_FN_NUM_ASIN                     0x00000004L
+#define SQL_FN_NUM_ATAN                     0x00000008L
+#define SQL_FN_NUM_ATAN2                    0x00000010L
+#define SQL_FN_NUM_CEILING                  0x00000020L
+#define SQL_FN_NUM_COS                      0x00000040L
+#define SQL_FN_NUM_COT                      0x00000080L
+#define SQL_FN_NUM_EXP                      0x00000100L
+#define SQL_FN_NUM_FLOOR                    0x00000200L
+#define SQL_FN_NUM_LOG                      0x00000400L
+#define SQL_FN_NUM_MOD                      0x00000800L
+#define SQL_FN_NUM_SIGN                     0x00001000L
+#define SQL_FN_NUM_SIN                      0x00002000L
+#define SQL_FN_NUM_SQRT                     0x00004000L
+#define SQL_FN_NUM_TAN                      0x00008000L
+#define SQL_FN_NUM_PI                       0x00010000L
+#define SQL_FN_NUM_RAND                     0x00020000L
+#define SQL_FN_NUM_DEGREES                  0x00040000L
+#define SQL_FN_NUM_LOG10                    0x00080000L
+#define SQL_FN_NUM_POWER                    0x00100000L
+#define SQL_FN_NUM_RADIANS                  0x00200000L
+#define SQL_FN_NUM_ROUND                    0x00400000L
+#define SQL_FN_NUM_TRUNCATE                 0x00800000L
+
+#define SQL_FN_STR_CONCAT                   0x00000001L
+#define SQL_FN_STR_INSERT                   0x00000002L
+#define SQL_FN_STR_LEFT                     0x00000004L
+#define SQL_FN_STR_LTRIM                    0x00000008L
+#define SQL_FN_STR_LENGTH                   0x00000010L
+#define SQL_FN_STR_LOCATE                   0x00000020L
+#define SQL_FN_STR_LCASE                    0x00000040L
+#define SQL_FN_STR_REPEAT                   0x00000080L
+#define SQL_FN_STR_REPLACE                  0x00000100L
+#define SQL_FN_STR_RIGHT                    0x00000200L
+#define SQL_FN_STR_RTRIM                    0x00000400L
+#define SQL_FN_STR_SUBSTRING                0x00000800L
+#define SQL_FN_STR_UCASE                    0x00001000L
+#define SQL_FN_STR_ASCII                    0x00002000L
+#define SQL_FN_STR_CHAR                     0x00004000L
+#define SQL_FN_STR_DIFFERENCE               0x00008000L
+#define SQL_FN_STR_LOCATE_2                 0x00010000L
+#define SQL_FN_STR_SOUNDEX                  0x00020000L
+#define SQL_FN_STR_SPACE                    0x00040000L
+#define SQL_FN_STR_BIT_LENGTH              0x00080000L
+#define SQL_FN_STR_CHAR_LENGTH             0x00100000L
+#define SQL_FN_STR_CHARACTER_LENGTH        0x00200000L
+#define SQL_FN_STR_OCTET_LENGTH                    0x00400000L
+#define SQL_FN_STR_POSITION                0x00800000L
+
+#define SQL_FN_TD_NOW                       0x00000001L
+#define SQL_FN_TD_CURDATE                   0x00000002L
+#define SQL_FN_TD_DAYOFMONTH                0x00000004L
+#define SQL_FN_TD_DAYOFWEEK                 0x00000008L
+#define SQL_FN_TD_DAYOFYEAR                 0x00000010L
+#define SQL_FN_TD_MONTH                     0x00000020L
+#define SQL_FN_TD_QUARTER                   0x00000040L
+#define SQL_FN_TD_WEEK                      0x00000080L
+#define SQL_FN_TD_YEAR                      0x00000100L
+#define SQL_FN_TD_CURTIME                   0x00000200L
+#define SQL_FN_TD_HOUR                      0x00000400L
+#define SQL_FN_TD_MINUTE                    0x00000800L
+#define SQL_FN_TD_SECOND                    0x00001000L
+#define SQL_FN_TD_TIMESTAMPADD              0x00002000L
+#define SQL_FN_TD_TIMESTAMPDIFF             0x00004000L
+#define SQL_FN_TD_DAYNAME                   0x00008000L
+#define SQL_FN_TD_MONTHNAME                 0x00010000L
+#define SQL_FN_TD_CURRENT_DATE             0x00020000L
+#define SQL_FN_TD_CURRENT_TIME             0x00040000L
+#define SQL_FN_TD_CURRENT_TIMESTAMP        0x00080000L
+#define SQL_FN_TD_EXTRACT                  0x00100000L
+
+#define SQL_POS_POSITION                    0x00000001L
+#define SQL_AT_ADD_COLUMN                   0x00000001L
+#define SQL_AT_DROP_COLUMN                  0x00000002L
+#define SQL_GB_NO_RELATION                  0x0003
+#define SQL_BIND_BY_COLUMN              0UL
+#define SQL_BIND_TYPE_DEFAULT           SQL_BIND_BY_COLUMN  /* Default value */
+#define SQL_ATTR_READONLY               0
+#define SQL_FETCH_PREV                  SQL_FETCH_PRIOR
+#define SQL_ROW_SUCCESS                 0
+#define SQL_ROW_NOROW                   3
+#define SQL_NOSCAN                     2
+
+#define SQL_RD_OFF                      0UL
+#define SQL_RD_ON                       1UL
+#define SQL_RD_DEFAULT                  SQL_RD_ON
+
+#define SQL_NOSCAN_OFF                  0UL
+#define SQL_NOSCAN_ON                   1UL
+#define SQL_NOSCAN_DEFAULT              SQL_NOSCAN_OFF
diff --git a/src/iodbc/postgres/isql.h b/src/iodbc/postgres/isql.h
deleted file mode 100644 (file)
index 4b62249..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-#ifndef _INTRINSIC_SQL_H
-# define _INTRINSIC_SQL_H
-
-#ifndef OS2
-typedef unsigned char           UCHAR;
-#endif
-typedef long int                SDWORD;
-typedef short int               SWORD;
-typedef unsigned long int       UDWORD;
-typedef unsigned short int      UWORD;
-
-#ifndef FAR
-#  define FAR
-#endif
-#ifndef NEAR                                                                    
-#  define NEAR                                                                 
-#endif       
-#ifndef HANDLE                                                                  
-  typedef int                          HANDLE;                                 
-  #endif          
-#ifndef HGLOBAL                                                                  
-  typedef HANDLE                          HGLOBAL;                                 
-  #endif          
-#ifndef SQL_INDEX_OTHER                                                                  
-#define SQL_INDEX_OTHER                 3
-  #endif          
-
-#  ifndef BOOL
-#    define BOOL                       int
-#  endif
-#  ifndef CHAR
-#    define CHAR                       char
-#  endif
-#  ifndef FALSE
-#    define FALSE                      (0 != 0)
-#  endif
-#  ifndef HWND
-#    define HWND                       int
-#  endif
-#  ifndef SQLHWND
-#    define SQLHWND                       int
-#  endif
-#  ifndef LONG
-#    define LONG                       long
-#  endif
-#  ifndef PASCAL
-#    define PASCAL
-#  endif
-#  ifndef SHORT
-#    define SHORT                      short
-#  endif
-#  ifndef SQL_API
-#    define SQL_API
-#  endif
-#  ifndef SQL_LOCAL_API
-#    define SQL_LOCAL_API
-#  endif
-#  ifndef TRUE
-#    define TRUE                       (0 == 0)
-#  endif
-
-typedef struct tagDATE_STRUCT
-{
-SWORD    year;
-UWORD   month;
-UWORD   day;
-} DATE_STRUCT;
-
-typedef struct tagTIME_STRUCT
-{
-UWORD   hour;
-UWORD   minute;
-UWORD   second;
-} TIME_STRUCT;
-
-typedef struct tagTIMESTAMP_STRUCT
-{
-SWORD    year;
-UWORD   month;
-UWORD   day;
-UWORD   hour;
-UWORD   minute;
-UWORD   second;
-UDWORD    fraction;
-} TIMESTAMP_STRUCT;
-
-
-
-typedef UCHAR FAR*               PTR,
-             FAR*               SQLPTR;
-
-typedef void FAR*               HENV,
-             FAR*               SQLHENV;
-typedef void FAR*               HDBC,
-             FAR*               SQLHDBC;
-typedef void FAR*               HSTMT,
-             FAR*               SQLHSTMT;
-typedef SDWORD                  SQLINTEGER;  
-typedef signed short            RETCODE;
-typedef UCHAR                   SQLCHAR;
-typedef UWORD                   SQLUSMALLINT;
-typedef PTR              SQLPOINTER;
-typedef SWORD                   SQLSMALLINT;
-typedef UDWORD                  SQLUINTEGER;
-
-#  ifdef WIN32
-#    define SQL_API                     __stdcall
-#  else
-#    define SQL_API                     /* giovanni EXPORT CALLBACK */
-#  endif
-#  ifdef OS2
-#    ifdef BCPP
-#      define _Optlink
-#      define _System                  _syscall
-#    endif
-#    undef  SQL_API
-#    define SQL_API                    _System
-#  endif
-
-# define ODBCVER                        0x0200
-
-# define SQL_MAX_MESSAGE_LENGTH         512
-# define SQL_MAX_DSN_LENGTH             32
-
-/* return code */
-# define SQL_INVALID_HANDLE             (-2)
-# define SQL_ERROR                      (-1)
-# define SQL_SUCCESS                    0
-# define SQL_SUCCESS_WITH_INFO          1
-# define SQL_NO_DATA_FOUND              100
-
-/* standard SQL datatypes (agree with ANSI type numbering) */
-# define SQL_CHAR                       1
-# define SQL_NUMERIC                    2
-# define SQL_DECIMAL                    3
-# define SQL_INTEGER                    4
-# define SQL_SMALLINT                   5
-# define SQL_FLOAT                      6
-# define SQL_REAL                       7
-# define SQL_DOUBLE                     8
-# define SQL_VARCHAR                    12
-
-# define SQL_TYPE_MIN                   SQL_CHAR
-# define SQL_TYPE_NULL                  0
-# define SQL_TYPE_MAX                   SQL_VARCHAR
-
-/* C to SQL datatype mapping */
-# define SQL_C_CHAR                     SQL_CHAR
-# define SQL_C_LONG                     SQL_INTEGER
-# define SQL_C_SHORT                    SQL_SMALLINT
-# define SQL_C_FLOAT                    SQL_REAL
-# define SQL_C_DOUBLE                   SQL_DOUBLE
-# define SQL_C_DEFAULT                  99
-
-# define SQL_NO_NULLS                   0
-# define SQL_NULLABLE                   1
-# define SQL_NULLABLE_UNKNOWN           2
-
-/* some special length values */
-# define SQL_NULL_DATA                  (-1)
-# define SQL_DATA_AT_EXEC               (-2)
-# define SQL_NTS                        (-3)
-
-/* SQLFreeStmt flag values */
-# define SQL_CLOSE                      0
-# define SQL_DROP                       1
-# define SQL_UNBIND                     2
-# define SQL_RESET_PARAMS               3
-
-/* SQLTransact flag values */
-# define SQL_COMMIT                     0
-# define SQL_ROLLBACK                   1
-
-/* SQLColAttributes flag values */
-# define SQL_COLUMN_COUNT               0
-# define SQL_COLUMN_LABEL               18
-# define SQL_COLATT_OPT_MAX             SQL_COLUMN_LABEL
-# define SQL_COLUMN_DRIVER_START        1000
-
-# define SQL_COLATT_OPT_MIN             SQL_COLUMN_COUNT
-
-/* Null handles */
-# define SQL_NULL_HENV                  0
-# define SQL_NULL_HDBC                  0
-# define SQL_NULL_HSTMT                 0
-
-#endif
-
diff --git a/src/iodbc/postgres/isqlext.h b/src/iodbc/postgres/isqlext.h
deleted file mode 100644 (file)
index 164ea16..0000000
+++ /dev/null
@@ -1,321 +0,0 @@
-#ifndef _INTRINSIC_SQLEXT_H
-# define _INTRINSIC_SQLEXT_H
-
-# include       <../iodbc/postgres/isql.h>
-
-# define SQL_STILL_EXECUTING            2
-# define SQL_NEED_DATA                  99
-
-/* extend SQL datatypes */
-# define SQL_DATE                       9
-# define SQL_TIME                       10
-# define SQL_TIMESTAMP                  11
-# define SQL_LONGVARCHAR                (-1)
-# define SQL_BINARY                     (-2)
-# define SQL_VARBINARY                  (-3)
-# define SQL_LONGVARBINARY              (-4)
-# define SQL_BIGINT                     (-5)
-# define SQL_TINYINT                    (-6)
-# define SQL_BIT                        (-7)    /* conflict with SQL3 ??? */
-# define SQL_TYPE_DRIVER_START          (-80)
-
-/* C to SQL datatype mapping */
-# define SQL_C_DATE                     SQL_DATE
-# define SQL_C_TIME                     SQL_TIME
-# define SQL_C_TIMESTAMP                SQL_TIMESTAMP
-# define SQL_C_BINARY                   SQL_BINARY
-# define SQL_C_BIT                      SQL_BIT
-# define SQL_C_TINYINT                  SQL_TINYINT
-
-# define SQL_SIGNED_OFFSET              (-20)
-# define SQL_UNSIGNED_OFFSET            (-22)
-
-# define SQL_C_SLONG                    (SQL_C_LONG  + SQL_SIGNED_OFFSET)
-# define SQL_C_SSHORT                   (SQL_C_SHORT + SQL_SIGNED_OFFSET)
-# define SQL_C_STINYINT                 (SQL_TINYINT + SQL_SIGNED_OFFSET)
-# define SQL_C_ULONG                    (SQL_C_LONG  + SQL_UNSIGNED_OFFSET)
-# define SQL_C_USHORT                   (SQL_C_SHORT + SQL_UNSIGNED_OFFSET)
-# define SQL_C_UTINYINT                 (SQL_TINYINT + SQL_UNSIGNED_OFFSET)
-# define SQL_C_BOOKMARK                 SQL_C_ULONG
-
-# if defined(SQL_TYPE_MIN)
-#   undef  SQL_TYPE_MIN
-#   define SQL_TYPE_MIN                 SQL_BIT
-/* Note:If SQL_BIT uses SQL3 value (i.e. 14) then,
- *      SQL_TYPE_MIN need to be defined as SQL_TINYINT
- *      (i.e. -6).
- */
-# endif
-
-# define SQL_ALL_TYPES                  0
-
-/* SQLDriverConnect flag values */
-# define SQL_DRIVER_NOPROMPT            0
-# define SQL_DRIVER_COMPLETE            1
-# define SQL_DRIVER_PROMPT              2
-# define SQL_DRIVER_COMPLETE_REQUIRED   3
-
-/* SQLSetParam extensions */
-# define SQL_DEFAULT_PARAM              (-5)
-# define SQL_IGNORE                     (-6)
-
-/* function number for SQLGetFunctions and _iodbcdm_getproc */
-# define SQL_API_SQLALLOCCONNECT        1
-# define SQL_API_SQLALLOCENV            2
-# define SQL_API_SQLALLOCSTMT           3
-# define SQL_API_SQLBINDCOL             4
-# define SQL_API_SQLCANCEL              5
-# define SQL_API_SQLCOLATTRIBUTES       6
-# define SQL_API_SQLCONNECT             7
-# define SQL_API_SQLDESCRIBECOL         8
-# define SQL_API_SQLDISCONNECT          9
-# define SQL_API_SQLERROR               10
-# define SQL_API_SQLEXECDIRECT          11
-# define SQL_API_SQLEXECUTE             12
-# define SQL_API_SQLFETCH               13
-# define SQL_API_SQLFREECONNECT         14
-# define SQL_API_SQLFREEENV             15
-# define SQL_API_SQLFREESTMT            16
-# define SQL_API_SQLGETCURSORNAME       17
-# define SQL_API_SQLNUMRESULTCOLS       18
-# define SQL_API_SQLPREPARE             19
-# define SQL_API_SQLROWCOUNT            20
-# define SQL_API_SQLSETCURSORNAME       21
-# define SQL_API_SQLSETPARAM            22
-# define SQL_API_SQLTRANSACT            23
-
-# define SQL_NUM_FUNCTIONS              23
-
-# define SQL_EXT_API_START              40
-
-# define SQL_API_SQLCOLUMNS             40
-
-# define SQL_API_SQLDRIVERCONNECT       41
-# define SQL_API_SQLGETCONNECTOPTION    42
-# define SQL_API_SQLGETDATA             43
-# define SQL_API_SQLGETFUNCTIONS        44
-# define SQL_API_SQLGETINFO             45
-# define SQL_API_SQLGETSTMTOPTION       46
-# define SQL_API_SQLGETTYPEINFO         47
-# define SQL_API_SQLPARAMDATA           48
-# define SQL_API_SQLPUTDATA             49
-# define SQL_API_SQLSETCONNECTOPTION    50
-# define SQL_API_SQLSETSTMTOPTION       51
-# define SQL_API_SQLSPECIALCOLUMNS      52
-# define SQL_API_SQLSTATISTICS          53
-# define SQL_API_SQLTABLES              54
-
-# define SQL_API_SQLBROWSECONNECT       55
-# define SQL_API_SQLCOLUMNPRIVILEGES    56
-# define SQL_API_SQLDATASOURCES         57
-# define SQL_API_SQLDESCRIBEPARAM       58
-# define SQL_API_SQLEXTENDEDFETCH       59
-# define SQL_API_SQLFOREIGNKEYS         60
-# define SQL_API_SQLMORERESULTS         61
-# define SQL_API_SQLNATIVESQL           62
-# define SQL_API_SQLNUMPARAMS           63
-# define SQL_API_SQLPARAMOPTIONS        64
-# define SQL_API_SQLPRIMARYKEYS         65
-# define SQL_API_SQLPROCEDURECOLUMNS    66
-# define SQL_API_SQLPROCEDURES          67
-# define SQL_API_SQLSETPOS              68
-# define SQL_API_SQLSETSCROLLOPTIONS    69
-# define SQL_API_SQLTABLEPRIVILEGES     70
-
-# define SQL_API_SQLDRIVERS             71
-# define SQL_API_SQLBINDPARAMETER       72
-# define SQL_EXT_API_LAST               SQL_API_SQLBINDPARAMETER
-
-# define SQL_API_ALL_FUNCTIONS          0
-
-/* SQLGetInfo infor number */
-# define SQL_INFO_FIRST                 0
-# define SQL_DRIVER_HDBC                3
-# define SQL_DRIVER_HENV                4
-# define SQL_DRIVER_HSTMT               5
-# define SQL_DRIVER_NAME                6
-# define SQL_ODBC_VER                   10
-# define SQL_CURSOR_COMMIT_BEHAVIOR     23
-# define SQL_CURSOR_ROLLBACK_BEHAVIOR   24
-# define SQL_DEFAULT_TXN_ISOLATION      26
-
-# define SQL_TXN_ISOLATION_OPTION       72
-# define SQL_NON_NULLABLE_COLUMNS       75
-
-# define SQL_DRIVER_HLIB                76
-# define SQL_DRIVER_ODBC_VER            77
-
-# define SQL_QUALIFIER_LOCATION         114
-
-# define SQL_INFO_LAST                  SQL_QUALIFIER_LOCATION
-
-# define SQL_INFO_DRIVER_START          1000
-
-
-/* SQL_TXN_ISOLATION_OPTION masks */
-# define SQL_TXN_READ_UNCOMMITTED       0x00000001L
-# define SQL_TXN_READ_COMMITTED         0x00000002L
-# define SQL_TXN_REPEATABLE_READ        0x00000004L
-# define SQL_TXN_SERIALIZABLE           0x00000008L
-# define SQL_TXN_VERSIONING             0x00000010L
-
-/* SQL_CURSOR_COMMIT_BEHAVIOR and SQL_CURSOR_ROLLBACK_BEHAVIOR values */
-
-# define SQL_CB_DELETE                  0x0000
-# define SQL_CB_CLOSE                   0x0001
-# define SQL_CB_PRESERVE                0x0002
-
-/* options for SQLGetStmtOption/SQLSetStmtOption */
-# define SQL_QUERY_TIMEOUT              0
-# define SQL_MAX_ROWS                   1
-# define SQL_NOSCAN                     2
-# define SQL_MAX_LENGTH                 3
-# define SQL_ASYNC_ENABLE               4
-# define SQL_BIND_TYPE                  5
-# define SQL_CURSOR_TYPE                6
-# define SQL_CONCURRENCY                7
-# define SQL_KEYSET_SIZE                8
-# define SQL_ROWSET_SIZE                9
-# define SQL_SIMULATE_CURSOR            10
-# define SQL_RETRIEVE_DATA              11
-# define SQL_USE_BOOKMARKS              12
-# define SQL_GET_BOOKMARK               13      /* GetStmtOption Only */
-# define SQL_ROW_NUMBER                 14      /* GetStmtOption Only */
-# define SQL_STMT_OPT_MAX               SQL_ROW_NUMBER
-
-# define SQL_STMT_OPT_MIN               SQL_QUERY_TIMEOUT
-
-
-/* SQL_QUERY_TIMEOUT options */
-# define SQL_QUERY_TIMEOUT_DEFAULT      0UL
-
-/* SQL_MAX_ROWS options */
-# define SQL_MAX_ROWS_DEFAULT           0UL
-
-/* SQL_MAX_LENGTH options */
-# define SQL_MAX_LENGTH_DEFAULT         0UL
-
-/* SQL_CONCURRENCY options */
-# define SQL_CONCUR_READ_ONLY           1
-# define SQL_CONCUR_LOCK                2
-# define SQL_CONCUR_ROWVER              3
-# define SQL_CONCUR_VALUES              4
-
-/* options for SQLSetConnectOption/SQLGetConnectOption */
-# define SQL_ACCESS_MODE                101
-# define SQL_AUTOCOMMIT                 102
-# define SQL_LOGIN_TIMEOUT              103
-# define SQL_OPT_TRACE                  104
-# define SQL_OPT_TRACEFILE              105
-# define SQL_TRANSLATE_DLL              106
-# define SQL_TRANSLATE_OPTION           107
-# define SQL_TXN_ISOLATION              108
-# define SQL_CURRENT_QUALIFIER          109
-# define SQL_ODBC_CURSORS               110
-# define SQL_QUIET_MODE                 111
-# define SQL_PACKET_SIZE                112
-# define SQL_CONN_OPT_MAX               SQL_PACKET_SIZE
-# define SQL_CONNECT_OPT_DRVR_START     1000
-
-# define SQL_CONN_OPT_MIN               SQL_ACCESS_MODE
-
-/* SQL_ACCESS_MODE options */
-# define SQL_MODE_READ_WRITE            0UL
-# define SQL_MODE_READ_ONLY             1UL
-# define SQL_MODE_DEFAULT               SQL_MODE_READ_WRITE
-
-/* SQL_AUTOCOMMIT options */
-# define SQL_AUTOCOMMIT_OFF             0UL
-# define SQL_AUTOCOMMIT_ON              1UL
-# define SQL_AUTOCOMMIT_DEFAULT         SQL_AUTOCOMMIT_ON
-
-/* SQL_LOGIN_TIMEOUT options */
-# define SQL_LOGIN_TIMEOUT_DEFAULT      15UL
-
-/* SQL_OPT_TRACE options */
-# define SQL_OPT_TRACE_OFF              0UL
-# define SQL_OPT_TRACE_ON               1UL
-# define SQL_OPT_TRACE_DEFAULT          SQL_OPT_TRACE_OFF
-# define SQL_OPT_TRACE_FILE_DEFAULT     "odbc.log"
-
-/* SQL_ODBC_CURSORS options */
-# define SQL_CUR_USE_IF_NEEDED          0UL
-# define SQL_CUR_USE_ODBC               1UL
-# define SQL_CUR_USE_DRIVER             2UL
-# define SQL_CUR_DEFAULT                SQL_CUR_USE_DRIVER
-
-/* Column types and scopes in SQLSpecialColumns. */
-# define SQL_BEST_ROWID                 1
-# define SQL_ROWVER                     2
-
-# define SQL_SCOPE_CURROW               0
-# define SQL_SCOPE_TRANSACTION          1
-# define SQL_SCOPE_SESSION              2
-
-/* Operations in SQLSetPos */
-# define SQL_ADD                        4
-
-/* Lock options in SQLSetPos */
-# define SQL_LOCK_NO_CHANGE             0
-# define SQL_LOCK_EXCLUSIVE             1
-# define SQL_LOCK_UNLOCK                2
-
-/* SQLExtendedFetch flag values */
-# define SQL_FETCH_NEXT                 1
-# define SQL_FETCH_FIRST                2
-# define SQL_FETCH_LAST                 3
-# define SQL_FETCH_PRIOR                4
-# define SQL_FETCH_ABSOLUTE             5
-# define SQL_FETCH_RELATIVE             6
-# define SQL_FETCH_BOOKMARK             8
-
-/* Defines for SQLBindParameter/SQLProcedureColumns */
-# define SQL_PARAM_TYPE_UNKNOWN         0
-# define SQL_PARAM_INPUT                1
-# define SQL_PARAM_INPUT_OUTPUT         2
-# define SQL_RESULT_COL                 3
-# define SQL_PARAM_OUTPUT               4
-
-/* Defines used by Driver Manager for mapping SQLSetParam to SQLBindParameter */
-# define SQL_PARAM_TYPE_DEFAULT         SQL_PARAM_INPUT_OUTPUT
-# define SQL_SETPARAM_VALUE_MAX         (-1L)
-
-/* SQLStatistics flag values */
-# define SQL_INDEX_UNIQUE               0
-# define SQL_INDEX_ALL                  1
-
-# define SQL_QUICK                      0
-# define SQL_ENSURE                     1
-
-/* SQLSetScrollOption flag values */
-# define SQL_SCROLL_FORWARD_ONLY        0L
-# define SQL_SCROLL_KEYSET_DRIVEN       (-1L)
-# define SQL_SCROLL_DYNAMIC             (-2L)
-# define SQL_SCROLL_STATIC              (-3L)
-
-# if defined(__cplusplus) || defined(__IBMCPP__)
-        extern  "C" {
-# endif
-
-
-/* SQL CONVERT_FUNCTIONS function */
-#define SQL_FN_CVT_CONVERT             0x00000001L
-
-/* SQL_SUBQUERIES masks */
-
-#define SQL_SQ_COMPARISON                   0x00000001L
-#define SQL_SQ_EXISTS                       0x00000002L
-#define SQL_SQ_IN                           0x00000004L
-#define SQL_SQ_QUANTIFIED                   0x00000008L
-#define SQL_SQ_CORRELATED_SUBQUERIES        0x00000010L
-
-
-
-RETCODE SQL_API SQLSetConnectOption (HDBC, UWORD, UDWORD);
-RETCODE SQL_API SQLNumResultCols ( HSTMT, SWORD FAR* );
-
-# if defined(__cplusplus) || defined(__IBMCPP__)
-        }
-# endif
-
-#endif
diff --git a/src/iodbc/postgres/odbc_funcs.h b/src/iodbc/postgres/odbc_funcs.h
deleted file mode 100644 (file)
index 508d5bd..0000000
+++ /dev/null
@@ -1,380 +0,0 @@
-#define SQLRETURN RETCODE
-SQLRETURN SQL_API SQLDriverConnect(
-    SQLHDBC            hdbc,
-    SQLHWND            hwnd,
-    SQLCHAR FAR       *szConnStrIn,
-    SQLSMALLINT        cbConnStrIn,
-    SQLCHAR FAR       *szConnStrOut,
-    SQLSMALLINT        cbConnStrOutMax,
-    SQLSMALLINT FAR   *pcbConnStrOut,
-    SQLUSMALLINT       fDriverCompletion);
-
-SQLRETURN SQL_API SQLBrowseConnect(
-    SQLHDBC            hdbc,
-    SQLCHAR FAR       *szConnStrIn,
-    SQLSMALLINT        cbConnStrIn,
-    SQLCHAR FAR       *szConnStrOut,
-    SQLSMALLINT        cbConnStrOutMax,
-    SQLSMALLINT FAR   *pcbConnStrOut);
-
-SQLRETURN SQL_API SQLColumnPrivileges(
-    SQLHSTMT           hstmt,
-    SQLCHAR FAR       *szCatalogName,
-    SQLSMALLINT        cbCatalogName,
-    SQLCHAR FAR       *szSchemaName,
-    SQLSMALLINT        cbSchemaName,
-    SQLCHAR FAR       *szTableName,
-    SQLSMALLINT        cbTableName,
-    SQLCHAR FAR       *szColumnName,
-    SQLSMALLINT        cbColumnName);
-
-SQLRETURN SQL_API SQLDescribeParam(
-    SQLHSTMT           hstmt,
-    SQLUSMALLINT       ipar,
-    SQLSMALLINT FAR   *pfSqlType,
-    SQLUINTEGER FAR   *pcbParamDef,
-    SQLSMALLINT FAR   *pibScale,
-    SQLSMALLINT FAR   *pfNullable);
-
-SQLRETURN SQL_API SQLExtendedFetch(
-    SQLHSTMT           hstmt,
-    SQLUSMALLINT       fFetchType,
-    SQLINTEGER         irow,
-    SQLUINTEGER FAR   *pcrow,
-    SQLUSMALLINT FAR  *rgfRowStatus);
-
-SQLRETURN SQL_API SQLForeignKeys(
-    SQLHSTMT           hstmt,
-    SQLCHAR FAR       *szPkCatalogName,
-    SQLSMALLINT        cbPkCatalogName,
-    SQLCHAR FAR       *szPkSchemaName,
-    SQLSMALLINT        cbPkSchemaName,
-    SQLCHAR FAR       *szPkTableName,
-    SQLSMALLINT        cbPkTableName,
-    SQLCHAR FAR       *szFkCatalogName,
-    SQLSMALLINT        cbFkCatalogName,
-    SQLCHAR FAR       *szFkSchemaName,
-    SQLSMALLINT        cbFkSchemaName,
-    SQLCHAR FAR       *szFkTableName,
-    SQLSMALLINT        cbFkTableName);
-
-SQLRETURN SQL_API SQLMoreResults(
-    SQLHSTMT           hstmt);
-
-SQLRETURN SQL_API SQLNativeSql(
-    SQLHDBC            hdbc,
-    SQLCHAR FAR       *szSqlStrIn,
-    SQLINTEGER         cbSqlStrIn,
-    SQLCHAR FAR       *szSqlStr,
-    SQLINTEGER         cbSqlStrMax,
-    SQLINTEGER FAR    *pcbSqlStr);
-
-SQLRETURN SQL_API SQLNumParams(
-    SQLHSTMT           hstmt,
-    SQLSMALLINT FAR   *pcpar);
-
-SQLRETURN SQL_API SQLParamOptions(
-    SQLHSTMT           hstmt,
-    SQLUINTEGER        crow,
-    SQLUINTEGER FAR   *pirow);
-
-SQLRETURN SQL_API SQLPrimaryKeys(
-    SQLHSTMT           hstmt,
-    SQLCHAR FAR       *szCatalogName,
-    SQLSMALLINT        cbCatalogName,
-    SQLCHAR FAR       *szSchemaName,
-    SQLSMALLINT        cbSchemaName,
-    SQLCHAR FAR       *szTableName,
-    SQLSMALLINT        cbTableName);
-
-SQLRETURN SQL_API SQLProcedureColumns(
-    SQLHSTMT           hstmt,
-    SQLCHAR FAR       *szCatalogName,
-    SQLSMALLINT        cbCatalogName,
-    SQLCHAR FAR       *szSchemaName,
-    SQLSMALLINT        cbSchemaName,
-    SQLCHAR FAR       *szProcName,
-    SQLSMALLINT        cbProcName,
-    SQLCHAR FAR       *szColumnName,
-    SQLSMALLINT        cbColumnName);
-
-SQLRETURN SQL_API SQLProcedures(
-    SQLHSTMT           hstmt,
-    SQLCHAR FAR       *szCatalogName,
-    SQLSMALLINT        cbCatalogName,
-    SQLCHAR FAR       *szSchemaName,
-    SQLSMALLINT        cbSchemaName,
-    SQLCHAR FAR       *szProcName,
-    SQLSMALLINT        cbProcName);
-
-SQLRETURN SQL_API SQLSetPos(
-    SQLHSTMT           hstmt,
-    SQLUSMALLINT       irow,
-    SQLUSMALLINT       fOption,
-    SQLUSMALLINT       fLock);
-
-SQLRETURN SQL_API SQLTablePrivileges(
-    SQLHSTMT           hstmt,
-    SQLCHAR FAR       *szCatalogName,
-    SQLSMALLINT        cbCatalogName,
-    SQLCHAR FAR       *szSchemaName,
-    SQLSMALLINT        cbSchemaName,
-    SQLCHAR FAR       *szTableName,
-    SQLSMALLINT        cbTableName);
-
-SQLRETURN SQL_API SQLDrivers(
-    SQLHENV            henv,
-    SQLUSMALLINT       fDirection,
-    SQLCHAR FAR       *szDriverDesc,
-    SQLSMALLINT        cbDriverDescMax,
-    SQLSMALLINT FAR   *pcbDriverDesc,
-    SQLCHAR FAR       *szDriverAttributes,
-    SQLSMALLINT        cbDrvrAttrMax,
-    SQLSMALLINT FAR   *pcbDrvrAttr);
-
-SQLRETURN SQL_API SQLBindParameter(
-    SQLHSTMT           hstmt,
-    SQLUSMALLINT       ipar,
-    SQLSMALLINT        fParamType,
-    SQLSMALLINT        fCType,
-    SQLSMALLINT        fSqlType,
-    SQLUINTEGER        cbColDef,
-    SQLSMALLINT        ibScale,
-    SQLPOINTER         rgbValue,
-    SQLINTEGER         cbValueMax,
-    SQLINTEGER FAR    *pcbValue);
-
-SQLRETURN SQL_API SQLAllocConnect(
-    SQLHENV            henv,
-    SQLHDBC FAR       *phdbc);
-
-SQLRETURN SQL_API SQLAllocEnv(
-    SQLHENV FAR       *phenv);
-
-SQLRETURN SQL_API SQLAllocStmt(
-    SQLHDBC            hdbc,
-    SQLHSTMT FAR      *phstmt);
-
-SQLRETURN SQL_API SQLBindCol(
-    SQLHSTMT           hstmt,
-    SQLUSMALLINT       icol,
-    SQLSMALLINT        fCType,
-    SQLPOINTER         rgbValue,
-    SQLINTEGER         cbValueMax,
-    SQLINTEGER FAR    *pcbValue);
-
-SQLRETURN SQL_API SQLCancel(
-    SQLHSTMT           hstmt);
-
-SQLRETURN SQL_API SQLColAttributes(
-    SQLHSTMT           hstmt,
-    SQLUSMALLINT       icol,
-    SQLUSMALLINT       fDescType,
-    SQLPOINTER         rgbDesc,
-    SQLSMALLINT        cbDescMax,
-    SQLSMALLINT FAR   *pcbDesc,
-    SQLINTEGER FAR    *pfDesc);
-
-SQLRETURN SQL_API SQLConnect(
-    SQLHDBC            hdbc,
-    SQLCHAR FAR       *szDSN,
-    SQLSMALLINT        cbDSN,
-    SQLCHAR FAR       *szUID,
-    SQLSMALLINT        cbUID,
-    SQLCHAR FAR       *szAuthStr,
-    SQLSMALLINT        cbAuthStr);
-
-SQLRETURN SQL_API SQLDescribeCol(
-    SQLHSTMT           hstmt,
-    SQLUSMALLINT       icol,
-    SQLCHAR FAR       *szColName,
-    SQLSMALLINT        cbColNameMax,
-    SQLSMALLINT FAR   *pcbColName,
-    SQLSMALLINT FAR   *pfSqlType,
-    SQLUINTEGER FAR   *pcbColDef,
-    SQLSMALLINT FAR   *pibScale,
-    SQLSMALLINT FAR   *pfNullable);
-
-SQLRETURN SQL_API SQLDisconnect(
-    SQLHDBC            hdbc);
-
-SQLRETURN SQL_API SQLError(
-    SQLHENV            henv,
-    SQLHDBC            hdbc,
-    SQLHSTMT           hstmt,
-    SQLCHAR FAR       *szSqlState,
-    SQLINTEGER FAR    *pfNativeError,
-    SQLCHAR FAR       *szErrorMsg,
-    SQLSMALLINT        cbErrorMsgMax,
-    SQLSMALLINT FAR   *pcbErrorMsg);
-
-SQLRETURN SQL_API SQLExecDirect(
-    SQLHSTMT           hstmt,
-    SQLCHAR FAR       *szSqlStr,
-    SQLINTEGER         cbSqlStr);
-
-SQLRETURN SQL_API SQLExecute(
-    SQLHSTMT           hstmt);
-
-SQLRETURN SQL_API SQLFetch(
-    SQLHSTMT           hstmt);
-
-SQLRETURN SQL_API SQLFreeConnect(
-    SQLHDBC            hdbc);
-
-SQLRETURN SQL_API SQLFreeEnv(
-    SQLHENV            henv);
-
-SQLRETURN SQL_API SQLFreeStmt(
-    SQLHSTMT           hstmt,
-    SQLUSMALLINT       fOption);
-
-SQLRETURN SQL_API SQLGetCursorName(
-    SQLHSTMT           hstmt,
-    SQLCHAR FAR       *szCursor,
-    SQLSMALLINT        cbCursorMax,
-    SQLSMALLINT FAR   *pcbCursor);
-
-SQLRETURN SQL_API SQLNumResultCols(
-    SQLHSTMT           hstmt,
-    SQLSMALLINT FAR   *pccol);
-
-SQLRETURN SQL_API SQLPrepare(
-    SQLHSTMT           hstmt,
-    SQLCHAR FAR       *szSqlStr,
-    SQLINTEGER         cbSqlStr);
-
-SQLRETURN SQL_API SQLRowCount(
-    SQLHSTMT           hstmt,
-    SQLINTEGER FAR    *pcrow);
-
-SQLRETURN SQL_API SQLSetCursorName(
-    SQLHSTMT           hstmt,
-    SQLCHAR FAR       *szCursor,
-    SQLSMALLINT        cbCursor);
-
-SQLRETURN SQL_API SQLTransact(
-    SQLHENV            henv,
-    SQLHDBC            hdbc,
-    SQLUSMALLINT       fType);
-
-
-SQLRETURN SQL_API SQLSetParam(            /*      Use SQLBindParameter */
-    SQLHSTMT           hstmt,
-    SQLUSMALLINT       ipar,
-    SQLSMALLINT        fCType,
-    SQLSMALLINT        fSqlType,
-    SQLUINTEGER        cbParamDef,
-    SQLSMALLINT        ibScale,
-    SQLPOINTER         rgbValue,
-    SQLINTEGER FAR     *pcbValue);
-
-SQLRETURN SQL_API SQLColumns(
-    SQLHSTMT           hstmt,
-    SQLCHAR FAR       *szCatalogName,
-    SQLSMALLINT        cbCatalogName,
-    SQLCHAR FAR       *szSchemaName,
-    SQLSMALLINT        cbSchemaName,
-    SQLCHAR FAR       *szTableName,
-    SQLSMALLINT        cbTableName,
-    SQLCHAR FAR       *szColumnName,
-    SQLSMALLINT        cbColumnName);
-
-SQLRETURN SQL_API SQLGetConnectOption(
-    SQLHDBC            hdbc,
-    SQLUSMALLINT       fOption,
-    SQLPOINTER         pvParam);
-
-SQLRETURN SQL_API SQLGetData(
-    SQLHSTMT           hstmt,
-    SQLUSMALLINT       icol,
-    SQLSMALLINT        fCType,
-    SQLPOINTER         rgbValue,
-    SQLINTEGER         cbValueMax,
-    SQLINTEGER FAR    *pcbValue);
-
-SQLRETURN SQL_API SQLGetFunctions(
-    SQLHDBC            hdbc,
-    SQLUSMALLINT       fFunction,
-    SQLUSMALLINT FAR  *pfExists);
-
-SQLRETURN SQL_API SQLGetInfo(
-    SQLHDBC            hdbc,
-    SQLUSMALLINT       fInfoType,
-    SQLPOINTER         rgbInfoValue,
-    SQLSMALLINT        cbInfoValueMax,
-    SQLSMALLINT FAR   *pcbInfoValue);
-
-SQLRETURN SQL_API SQLGetStmtOption(
-    SQLHSTMT           hstmt,
-    SQLUSMALLINT       fOption,
-    SQLPOINTER         pvParam);
-
-SQLRETURN SQL_API SQLGetTypeInfo(
-    SQLHSTMT           hstmt,
-    SQLSMALLINT        fSqlType);
-
-SQLRETURN SQL_API SQLParamData(
-    SQLHSTMT           hstmt,
-    SQLPOINTER FAR    *prgbValue);
-
-SQLRETURN SQL_API SQLPutData(
-    SQLHSTMT           hstmt,
-    SQLPOINTER         rgbValue,
-    SQLINTEGER         cbValue);
-
-SQLRETURN SQL_API SQLSetConnectOption(
-    SQLHDBC            hdbc,
-    SQLUSMALLINT       fOption,
-    SQLUINTEGER        vParam);
-
-SQLRETURN SQL_API SQLSetStmtOption(
-    SQLHSTMT           hstmt,
-    SQLUSMALLINT       fOption,
-    SQLUINTEGER        vParam);
-
-SQLRETURN SQL_API SQLSpecialColumns(
-    SQLHSTMT           hstmt,
-    SQLUSMALLINT       fColType,
-    SQLCHAR FAR       *szCatalogName,
-    SQLSMALLINT        cbCatalogName,
-    SQLCHAR FAR       *szSchemaName,
-    SQLSMALLINT        cbSchemaName,
-    SQLCHAR FAR       *szTableName,
-    SQLSMALLINT        cbTableName,
-    SQLUSMALLINT       fScope,
-    SQLUSMALLINT       fNullable);
-
-SQLRETURN SQL_API SQLStatistics(
-    SQLHSTMT           hstmt,
-    SQLCHAR FAR       *szCatalogName,
-    SQLSMALLINT        cbCatalogName,
-    SQLCHAR FAR       *szSchemaName,
-    SQLSMALLINT        cbSchemaName,
-    SQLCHAR FAR       *szTableName,
-    SQLSMALLINT        cbTableName,
-    SQLUSMALLINT       fUnique,
-    SQLUSMALLINT       fAccuracy);
-
-SQLRETURN SQL_API SQLTables(
-    SQLHSTMT           hstmt,
-    SQLCHAR FAR       *szCatalogName,
-    SQLSMALLINT        cbCatalogName,
-    SQLCHAR FAR       *szSchemaName,
-    SQLSMALLINT        cbSchemaName,
-    SQLCHAR FAR       *szTableName,
-    SQLSMALLINT        cbTableName,
-    SQLCHAR FAR       *szTableType,
-    SQLSMALLINT        cbTableType);
-
-
-SQLRETURN SQL_API SQLDataSources(
-    SQLHENV            henv,
-    SQLUSMALLINT       fDirection,
-    SQLCHAR FAR       *szDSN,
-    SQLSMALLINT        cbDSNMax,
-    SQLSMALLINT FAR   *pcbDSN,
-    SQLCHAR FAR       *szDescription,
-    SQLSMALLINT        cbDescriptionMax,
-    SQLSMALLINT FAR   *pcbDescription);
-
diff --git a/src/iodbc/postgres/odbc_types.h b/src/iodbc/postgres/odbc_types.h
deleted file mode 100644 (file)
index 3633312..0000000
+++ /dev/null
@@ -1,298 +0,0 @@
-#define SQL_SPEC_STRING         "02.00"         /* String constant for version */
-#define SQL_ACTIVE_CONNECTIONS               0
-#define SQL_ACTIVE_STATEMENTS                1
-#define SQL_DATA_SOURCE_NAME                 2
-#define SQL_DATABASE_NAME               16    /* Use SQLGetConnectOption/SQL_CURRENT_QUALIFIER */
-#define SQL_DBMS_VER                        18
-#define SQL_FETCH_DIRECTION                  8
-#define SQL_ROW_UPDATES                     11
-#define SQL_ODBC_SAG_CLI_CONFORMANCE        12
-#define SQL_DRIVER_VER                       7
-#define SQL_SERVER_NAME                     13
-#define SQL_SEARCH_PATTERN_ESCAPE           14
-#define SQL_ODBC_API_CONFORMANCE             9
-#define SQL_ODBC_SQL_CONFORMANCE            15
-#define SQL_OAC_LEVEL1                      0x0001
-#define SQL_DBMS_NAME                       17
-#define SQL_ACCESSIBLE_PROCEDURES           20
-#define SQL_OUTER_JOINS                     38
-#define SQL_NEED_LONG_DATA_LEN              111
-#define SQL_EXPRESSIONS_IN_ORDERBY          27
-#define SQL_PROCEDURES                      21
-#define SQL_COLUMN_ALIAS                    87
-#define SQL_CONCAT_NULL_BEHAVIOR            22
-#define SQL_DATA_SOURCE_READ_ONLY           25
-#define SQL_ACCESSIBLE_TABLES               19
-#define SQL_IDENTIFIER_QUOTE_CHAR           29
-#define SQL_MAX_COLUMN_NAME_LEN             30
-#define SQL_MAX_CURSOR_NAME_LEN             31
-#define SQL_MAX_OWNER_NAME_LEN              32
-#define SQL_MAX_PROCEDURE_NAME_LEN          33
-#define SQL_MAX_QUALIFIER_NAME_LEN          34
-#define SQL_MAX_TABLE_NAME_LEN              35
-#define SQL_MULT_RESULT_SETS                36
-#define SQL_MULTIPLE_ACTIVE_TXN             37
-#define SQL_MAX_ROW_SIZE_INCLUDES_LONG      103
-#define SQL_OWNER_TERM                      39
-#define SQL_PROCEDURE_TERM                  40
-#define SQL_QUALIFIER_NAME_SEPARATOR        41
-#define SQL_QUALIFIER_TERM                  42
-#define SQL_SCROLL_CONCURRENCY              43
-#define SQL_SCROLL_OPTIONS                  44
-#define SQL_TABLE_TERM                      45
-#define SQL_TXN_CAPABLE                     46
-#define SQL_USER_NAME                       47
-#define SQL_CONVERT_FUNCTIONS               48
-#define SQL_SYSTEM_FUNCTIONS                51
-#define SQL_NUMERIC_FUNCTIONS               49
-#define SQL_FN_NUM_ABS                      0x00000001L
-#define SQL_FN_NUM_FLOOR                    0x00000200L
-#define SQL_FN_NUM_MOD                      0x00000800L
-#define SQL_FN_NUM_SIGN                     0x00001000L
-#define SQL_STRING_FUNCTIONS                50
-#define SQL_FN_STR_CONCAT                   0x00000001L
-#define SQL_FN_STR_LEFT                     0x00000004L
-#define SQL_FN_STR_LENGTH                   0x00000010L
-#define SQL_FN_STR_LOCATE                   0x00000020L
-#define SQL_FN_STR_LOCATE_2                 0x00010000L
-#define SQL_FN_STR_RIGHT                    0x00000200L
-#define SQL_FN_STR_SUBSTRING                0x00000800L
-#define SQL_FN_STR_REPLACE                  0x00000100L
-#define SQL_FN_STR_LCASE                    0x00000040L
-#define SQL_FN_STR_UCASE                    0x00001000L
-#define SQL_TIMEDATE_FUNCTIONS              52
-#define SQL_FN_TD_CURDATE                   0x00000002L
-#define SQL_CONVERT_BIGINT                  53
-#define SQL_CONVERT_BIT                     55
-#define SQL_CONVERT_CHAR                    56
-#define SQL_CONVERT_DATE                    57
-#define SQL_CONVERT_DECIMAL                 58
-#define SQL_CONVERT_DOUBLE                  59
-#define SQL_CONVERT_FLOAT                   60
-#define SQL_CONVERT_INTEGER                 61
-#define SQL_CONVERT_LONGVARCHAR             62
-#define SQL_CONVERT_NUMERIC                 63
-#define SQL_CONVERT_REAL                    64
-#define SQL_CONVERT_SMALLINT                65
-#define SQL_CONVERT_TIME                    66
-#define SQL_CONVERT_TIMESTAMP               67
-#define SQL_CONVERT_TIMESTAMP               67
-#define SQL_CONVERT_TINYINT                 68
-#define SQL_CONVERT_VARCHAR                 70
-#define SQL_CVT_CHAR                        0x00000001L
-#define SQL_CVT_NUMERIC                     0x00000002L
-#define SQL_CVT_DECIMAL                     0x00000004L
-#define SQL_CVT_INTEGER                     0x00000008L
-#define SQL_CVT_SMALLINT                    0x00000010L
-#define SQL_CVT_FLOAT                       0x00000020L
-#define SQL_CVT_REAL                        0x00000040L
-#define SQL_CVT_DOUBLE                      0x00000080L
-#define SQL_CVT_VARCHAR                     0x00000100L
-#define SQL_CVT_LONGVARCHAR                 0x00000200L
-#define SQL_CVT_BIT                         0x00001000L
-#define SQL_CVT_TINYINT                     0x00002000L
-#define SQL_CVT_BIGINT                      0x00004000L
-#define SQL_CVT_DATE                        0x00008000L
-#define SQL_CVT_TIME                        0x00010000L
-#define SQL_CVT_TIMESTAMP                   0x00020000L
-#define SQL_CVT_TIMESTAMP                   0x00020000L
-#define SQL_CONVERT_BINARY                  54
-#define SQL_CONVERT_VARBINARY               69
-#define SQL_CONVERT_LONGVARBINARY           71
-#define SQL_CORRELATION_NAME                74
-#define SQL_CN_DIFFERENT                    0x0001
-#define SQL_NNC_NON_NULL                    0x0001
-#define SQL_NULL_COLLATION                  85
-#define SQL_NC_START                        0x0002
-#define SQL_MAX_COLUMNS_IN_GROUP_BY         97
-#define SQL_MAX_COLUMNS_IN_ORDER_BY         99
-#define SQL_MAX_COLUMNS_IN_SELECT           100
-#define SQL_MAX_COLUMNS_IN_TABLE            101
-#define SQL_MAX_TABLES_IN_SELECT            106
-#define SQL_MAX_ROW_SIZE_INCLUDES_LONG      103
-#define SQL_MAX_ROW_SIZE                    104
-#define SQL_MAX_BINARY_LITERAL_LEN          112
-#define SQL_MAX_CHAR_LITERAL_LEN            108
-#define SQL_MAX_COLUMNS_IN_INDEX            98
-#define SQL_MAX_INDEX_SIZE                  102
-#define SQL_MAX_STATEMENT_LEN               105
-#define SQL_QL_START                        0x0001L
-#define SQL_SEARCHABLE                  3
-#define SQL_IDENTIFIER_CASE                 28
-#define SQL_COLUMN_NAME                 1
-#define SQL_COLUMN_TYPE                 2
-#define SQL_COLUMN_TYPE_NAME            14
-#define SQL_COLUMN_PRECISION            4
-#define SQL_COLUMN_DISPLAY_SIZE         6
-#define SQL_COLUMN_LENGTH               3
-#define SQL_COLUMN_SCALE                5
-#define SQL_COLUMN_NULLABLE             7
-#define SQL_COLUMN_SEARCHABLE           13
-#define SQL_COLUMN_UNSIGNED             8
-#define SQL_COLUMN_MONEY                9
-#define SQL_COLUMN_AUTO_INCREMENT       11
-#define SQL_COLUMN_CASE_SENSITIVE       12
-#define SQL_COLUMN_UPDATABLE            10
-#define SQL_COLUMN_OWNER_NAME           16
-#define SQL_COLUMN_QUALIFIER_NAME       17
-#define SQL_OSCC_COMPLIANT                  0x0001
-#define SQL_ODBC_SQL_OPT_IEF                73
-#define SQL_LIKE_ESCAPE_CLAUSE              113
-#define SQL_ORDER_BY_COLUMNS_IN_SELECT      90
-#define SQL_POS_OPERATIONS                  79
-#define SQL_POSITIONED_STATEMENTS           80
-#define SQL_LOCK_TYPES                      78
-#define SQL_BOOKMARK_PERSISTENCE            82
-#define SQL_ALTER_TABLE                     86
-#define SQL_OWNER_USAGE                     91
-#define SQL_QUALIFIER_USAGE                 92
-#define SQL_QUOTED_IDENTIFIER_CASE          93
-#define SQL_SUBQUERIES                      95
-#define SQL_UNION                           96
-#define SQL_TIMEDATE_DIFF_INTERVALS         110
-#define SQL_GETDATA_EXTENSIONS              81
-#define SQL_GD_ANY_COLUMN                   0x00000001L
-#define SQL_GD_ANY_ORDER                    0x00000002L
-#define SQL_GD_BOUND                        0x00000008L
-#define SQL_STATIC_SENSITIVITY              83
-#define SQL_SS_DELETIONS                    0x00000002L
-#define SQL_SS_UPDATES                      0x00000004L
-#define SQL_FILE_USAGE                      84
-#define SQL_FILE_NOT_SUPPORTED              0x0000
-#define SQL_GROUP_BY                        88
-#define SQL_GB_GROUP_BY_EQUALS_SELECT       0x0001
-#define SQL_KEYWORDS                        89
-#define SQL_SPECIAL_CHARACTERS              94
-#define SQL_TIMEDATE_ADD_INTERVALS          109
-#define SQL_FN_SYS_DBNAME                   0x00000002L
-#define SQL_FN_SYS_IFNULL                   0x00000004L
-#define SQL_FN_SYS_USERNAME                 0x00000001L
-#define SQL_FN_NUM_CEILING                  0x00000020L
-#define SQL_FN_NUM_EXP                      0x00000100L
-#define SQL_FN_NUM_LOG                      0x00000400L
-#define SQL_FN_NUM_LOG10                    0x00080000L
-#define SQL_FN_NUM_LOG10                    0x00080000L
-#define SQL_FN_NUM_POWER                    0x00100000L
-#define SQL_FN_NUM_SQRT                     0x00004000L
-#define SQL_FN_NUM_ROUND                    0x00400000L
-#define SQL_FN_STR_INSERT                   0x00000002L
-#define SQL_FN_STR_LTRIM                    0x00000008L
-#define SQL_FN_STR_RTRIM                    0x00000400L
-#define SQL_BLOB                          21
-#define SQL_BLOB_LOCATOR                  22
-#define SQL_CLOB                          23
-#define SQL_CLOB_LOCATOR                  24
-#define SQL_DBCLOB                        25
-#define SQL_DBCLOB_LOCATOR                26
-#define SQL_GRAPHIC                       27
-#define SQL_LONGVARGRAPHIC                30
-#define SQL_VARGRAPHIC                    32
-#define SQL_SQLSTATE_SIZE                8
-#define SQL_COLUMN_DISTINCT_TYPE        1250
-#define SQL_COLUMN_TABLE_NAME             15
-#define SQL_LEN_DATA_AT_EXEC_OFFSET  (-100)
-#define SQL_CB_NULL                         0x0000
-#define SQL_FN_NUM_RAND                     0x00020000L
-#define SQL_NOSCAN_OFF                  0UL     
-#define SQL_ASYNC_ENABLE_OFF            0UL
-#define SQL_CURSOR_STATIC               3UL
-#define SQL_SC_NON_UNIQUE               0UL
-#define SQL_UB_OFF                      0UL
-#define SQL_PC_NOT_PSEUDO               1
-#define SQL_PC_NON_PSEUDO               SQL_PC_NOT_PSEUDO
-#define SQL_UNSEARCHABLE                0
-
-/*
- * Following constants are missed in original odbc_types.h
- * Added by serg@informika.ru
- */
-
-#define SQL_UNKNOWN_TYPE               0
-
-/* SQLColAttributes subdefines for SQL_COLUMN_SEARCHABLE */
-/* These are also used by SQLGetInfo                     */
-#define SQL_UNSEARCHABLE                0
-#define SQL_LIKE_ONLY                   1
-#define SQL_ALL_EXCEPT_LIKE             2
-#define SQL_SEARCHABLE                  3
-#define SQL_PRED_SEARCHABLE                            SQL_SEARCHABLE
-
-/* Special return values for SQLGetData */
-#define SQL_NO_TOTAL                    (-4)
-
-/* SQL_CORRELATION_NAME values */
-
-#define SQL_CN_NONE                         0x0000
-#define SQL_CN_DIFFERENT                    0x0001
-#define SQL_CN_ANY                          0x0002
-
-/* SQL_NULL_COLLATION values */
-
-#define SQL_NC_HIGH                         0
-#define SQL_NC_LOW                          1
-#define SQL_NC_START                        0x0002
-#define SQL_NC_END                          0x0004
-
-/* SQL_GROUP_BY values */
-
-#define SQL_GB_NOT_SUPPORTED                0x0000
-#define SQL_GB_GROUP_BY_EQUALS_SELECT       0x0001
-#define SQL_GB_GROUP_BY_CONTAINS_SELECT     0x0002
-#define SQL_GB_NO_RELATION                  0x0003
-
-/* SQL_IDENTIFIER_CASE values */
-#define SQL_IC_UPPER                        1
-#define SQL_IC_LOWER                        2
-#define SQL_IC_SENSITIVE                    3
-#define SQL_IC_MIXED                        4
-
-/* SQL_ODBC_SQL_CONFORMANCE values */
-
-#define SQL_OSC_MINIMUM                     0x0000
-#define SQL_OSC_CORE                        0x0001
-#define SQL_OSC_EXTENDED                    0x0002
-
-/* SQL_SCROLL_OPTIONS masks */
-
-#define SQL_SO_FORWARD_ONLY                 0x00000001L
-#define SQL_SO_KEYSET_DRIVEN                0x00000002L
-#define SQL_SO_DYNAMIC                      0x00000004L
-#define SQL_SO_MIXED                        0x00000008L
-#define SQL_SO_STATIC                       0x00000010L
-
-/* SQL_TXN_CAPABLE values */
-
-#define SQL_TC_NONE                         0
-#define SQL_TC_DML                          1
-#define SQL_TC_ALL                          2
-#define SQL_TC_DDL_COMMIT                   3
-#define SQL_TC_DDL_IGNORE                   4
-
-/* SQL_ALTER_TABLE bitmasks */
-
-#if (ODBCVER >= 0x0200)
-#define SQL_AT_ADD_COLUMN                      0x00000001L
-#define SQL_AT_DROP_COLUMN                     0x00000002L
-#endif /* ODBCVER >= 0x0200 */
-
-#define SQL_MAX_USER_NAME_LEN               107
-
-/* SQLColAttributes subdefines for SQL_COLUMN_UPDATABLE */
-
-#define SQL_ATTR_READONLY               0
-#define SQL_ATTR_WRITE                  1
-#define SQL_ATTR_READWRITE_UNKNOWN      2
-
-/* SQLExtendedFetch "rgfRowStatus" element values */
-
-#define SQL_ROW_SUCCESS                  0
-#define SQL_ROW_DELETED                  1
-#define SQL_ROW_UPDATED                  2
-#define SQL_ROW_NOROW                    3
-#define SQL_ROW_ADDED                    4
-#define SQL_ROW_ERROR                    5
-
-/* SQL_TIMEDATE_FUNCTIONS */
-
-#define SQL_FN_TD_NOW                  0x00000001L
-#define SQL_FN_TD_CURTIME              0x00000200L
index 9e71ea0c4ae0b36fe146336e799703150a6e5bee..a0c215ca25c668468c43fde42c4ebbdb5132d3fa 100644 (file)
@@ -1,6 +1,6 @@
 /** Prepare a query
 
-    Copyright (C) 1995 by Ke Jin <kejin@empress.com> 
+    Copyright (C) 1995 by Ke Jin <kejin@empress.com>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 
 #include       <../iodbc/itrace.h>
 
-RETCODE SQL_API        SQLPrepare (
-                       HSTMT           hstmt,
-                       UCHAR FAR*      szSqlStr,
-                       SDWORD          cbSqlStr )
+
+RETCODE SQL_API SQLPrepare (
+                        HSTMT           hstmt,
+                        UCHAR FAR*      szSqlStr,
+                        SDWORD          cbSqlStr )
 {
-       STMT_t FAR*     pstmt   = (STMT_t*)hstmt;
-
-       HPROC           hproc   = SQL_NULL_HPROC;
-       RETCODE         retcode = SQL_SUCCESS;
-       int             sqlstat = en_00000;
-
-       if( hstmt == SQL_NULL_HSTMT 
-        || pstmt->hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       /* check state */
-       if( pstmt->asyn_on == en_NullProc )
-       {
-               /* not on asyn state */
-               switch( pstmt->state )
-               {       
-                       case en_stmt_fetched:
-                       case en_stmt_xfetched:
-                               sqlstat = en_24000;
-                               break;
-
-                       case en_stmt_needdata:
-                       case en_stmt_mustput:
-                       case en_stmt_canput:
-                               sqlstat = en_S1010;
-                               break;
-
-                       default:
-                               break;
-               }
-       }
-       else if( pstmt->asyn_on != en_Prepare )
-       {
-               /* asyn on other */
-               sqlstat = en_S1010;
-       }
-
-       if( sqlstat != en_00000 )
-       {
-               PUSHSQLERR ( pstmt->herr, sqlstat );
-               
-               return SQL_ERROR;
-       }
-       
-       if( szSqlStr == NULL )
-       {
-               PUSHSQLERR ( pstmt->herr, en_S1009 );
-
-               return SQL_ERROR;
-       }
-
-       if( cbSqlStr < 0 && cbSqlStr != SQL_NTS )
-       {
-               PUSHSQLERR ( pstmt->herr, en_S1090 );
-
-               return SQL_ERROR;
-       }
-
-       hproc = _iodbcdm_getproc( pstmt->hdbc, en_Prepare );
-
-       if( hproc == SQL_NULL_HPROC )
-       {
-               PUSHSQLERR ( pstmt->herr, en_IM001 );
-               return SQL_ERROR;
-       }
-
-       CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_Prepare, (
-                       pstmt->dhstmt, szSqlStr, cbSqlStr) )
+        STMT_t FAR*     pstmt   = (STMT_t*)hstmt;
+
+        HPROC           hproc   = SQL_NULL_HPROC;
+        RETCODE         retcode = SQL_SUCCESS;
+        int             sqlstat = en_00000;
+
+        if( hstmt == SQL_NULL_HSTMT
+         || pstmt->hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        /* check state */
+        if( pstmt->asyn_on == en_NullProc )
+        {
+                /* not on asyn state */
+                switch( pstmt->state )
+                {
+                        case en_stmt_fetched:
+                        case en_stmt_xfetched:
+                                sqlstat = en_24000;
+                                break;
+
+                        case en_stmt_needdata:
+                        case en_stmt_mustput:
+                        case en_stmt_canput:
+                                sqlstat = en_S1010;
+                                break;
+
+                        default:
+                                break;
+                }
+        }
+        else if( pstmt->asyn_on != en_Prepare )
+        {
+                /* asyn on other */
+                sqlstat = en_S1010;
+        }
+
+        if( sqlstat != en_00000 )
+        {
+                PUSHSQLERR ( pstmt->herr, sqlstat );
+
+                return SQL_ERROR;
+        }
+
+        if( szSqlStr == NULL )
+        {
+                PUSHSQLERR ( pstmt->herr, en_S1009 );
+
+                return SQL_ERROR;
+        }
+
+        if( cbSqlStr < 0 && cbSqlStr != SQL_NTS )
+        {
+                PUSHSQLERR ( pstmt->herr, en_S1090 );
+
+                return SQL_ERROR;
+        }
+
+        hproc = _iodbcdm_getproc( pstmt->hdbc, en_Prepare );
+
+        if( hproc == SQL_NULL_HPROC )
+        {
+                PUSHSQLERR ( pstmt->herr, en_IM001 );
+                return SQL_ERROR;
+        }
+
+        CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_Prepare, (
+                        pstmt->dhstmt, szSqlStr, cbSqlStr) )
 
 #if 0
-       retcode = hproc ( pstmt->dhstmt, szSqlStr, cbSqlStr );
+        retcode = hproc ( pstmt->dhstmt, szSqlStr, cbSqlStr );
 #endif
 
-       /* stmt state transition */
-       if( pstmt->asyn_on == en_Prepare )
-       {
-               switch( retcode )
-               {
-                       case SQL_SUCCESS:
-                       case SQL_SUCCESS_WITH_INFO:
-                       case SQL_ERROR:
-                               pstmt->asyn_on = en_NullProc;
-                               return retcode;
-
-                       case SQL_STILL_EXECUTING:
-                       default:
-                               return retcode;
-               }
-       }
-
-       switch( retcode )
-       {
-               case SQL_STILL_EXECUTING: 
-                       pstmt->asyn_on = en_Prepare;
-                       break;
-
-               case SQL_SUCCESS: 
-               case SQL_SUCCESS_WITH_INFO:
-                       pstmt->state = en_stmt_prepared;
-                       pstmt->prep_state = 1;
-                       break;
-
-               case SQL_ERROR:
-                       switch( pstmt->state )
-                       {
-                               case en_stmt_prepared:
-                               case en_stmt_executed:
-                                       pstmt->state = en_stmt_allocated;
-                                       pstmt->prep_state = 0;
-                                       break;
-
-                               default:
-                                       break;
-                       }
-
-               default:
-                       break;
-       }
-
-       return retcode;
+        /* stmt state transition */
+        if( pstmt->asyn_on == en_Prepare )
+        {
+                switch( retcode )
+                {
+                        case SQL_SUCCESS:
+                        case SQL_SUCCESS_WITH_INFO:
+                        case SQL_ERROR:
+                                pstmt->asyn_on = en_NullProc;
+                                return retcode;
+
+                        case SQL_STILL_EXECUTING:
+                        default:
+                                return retcode;
+                }
+        }
+
+        switch( retcode )
+        {
+                case SQL_STILL_EXECUTING:
+                        pstmt->asyn_on = en_Prepare;
+                        break;
+
+                case SQL_SUCCESS:
+                case SQL_SUCCESS_WITH_INFO:
+                        pstmt->state = en_stmt_prepared;
+                        pstmt->prep_state = 1;
+                        break;
+
+                case SQL_ERROR:
+                        switch( pstmt->state )
+                        {
+                                case en_stmt_prepared:
+                                case en_stmt_executed:
+                                        pstmt->state = en_stmt_allocated;
+                                        pstmt->prep_state = 0;
+                                        break;
+
+                                default:
+                                        break;
+                        }
+
+                default:
+                        break;
+        }
+
+        return retcode;
 }
 
-RETCODE SQL_API        SQLSetCursorName (
-                       HSTMT           hstmt,
-                       UCHAR FAR*      szCursor,
-                       SWORD           cbCursor )
+RETCODE SQL_API SQLSetCursorName (
+                        HSTMT           hstmt,
+                        UCHAR FAR*      szCursor,
+                        SWORD           cbCursor )
 {
-       STMT_t FAR*     pstmt   = (STMT_t*)hstmt;
-       HPROC           hproc   = SQL_NULL_HPROC;
-
-       RETCODE         retcode = SQL_SUCCESS;
-       int             sqlstat = en_00000;
-
-       if( hstmt == SQL_NULL_HSTMT 
-        || pstmt->hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       if( szCursor == NULL )
-       {
-               PUSHSQLERR ( pstmt->herr, en_S1009 );
-
-               return SQL_ERROR;
-       }
-
-       if( cbCursor < 0 && cbCursor != SQL_NTS )
-       {
-               PUSHSQLERR ( pstmt->herr, en_S1090 );
-
-               return SQL_ERROR;
-       }
-
-       /* check state */
-       if( pstmt->asyn_on != en_NullProc )
-       {
-               sqlstat = en_S1010;
-       }
-       else
-       {
-               switch( pstmt->state )
-               {
-                       case en_stmt_executed:
-                       case en_stmt_cursoropen:
-                       case en_stmt_fetched:
-                       case en_stmt_xfetched:
-                               sqlstat = en_24000;
-                               break;
-
-                       case en_stmt_needdata:
-                       case en_stmt_mustput:
-                       case en_stmt_canput:
-                               sqlstat = en_S1010;
-                               break;
-
-                       default:
-                               break;
-               }
-       }
-
-       if( sqlstat != en_00000 )
-       {
-               PUSHSQLERR ( pstmt->herr, sqlstat );
-
-               return SQL_ERROR;
-       }
-
-       hproc = _iodbcdm_getproc( pstmt->hdbc, en_SetCursorName);
-
-       if( hproc == SQL_NULL_HPROC )
-       {
-               PUSHSQLERR ( pstmt->herr, en_IM001 );
-
-               return SQL_ERROR;
-       }
-
-       CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_SetCursorName, (
-                       pstmt->dhstmt, szCursor, cbCursor ) )
+        STMT_t FAR*     pstmt   = (STMT_t*)hstmt;
+        HPROC           hproc   = SQL_NULL_HPROC;
+
+        RETCODE         retcode = SQL_SUCCESS;
+        int             sqlstat = en_00000;
+
+        if( hstmt == SQL_NULL_HSTMT
+         || pstmt->hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        if( szCursor == NULL )
+        {
+                PUSHSQLERR ( pstmt->herr, en_S1009 );
+
+                return SQL_ERROR;
+        }
+
+        if( cbCursor < 0 && cbCursor != SQL_NTS )
+        {
+                PUSHSQLERR ( pstmt->herr, en_S1090 );
+
+                return SQL_ERROR;
+        }
+
+        /* check state */
+        if( pstmt->asyn_on != en_NullProc )
+        {
+                sqlstat = en_S1010;
+        }
+        else
+        {
+                switch( pstmt->state )
+                {
+                        case en_stmt_executed:
+                        case en_stmt_cursoropen:
+                        case en_stmt_fetched:
+                        case en_stmt_xfetched:
+                                sqlstat = en_24000;
+                                break;
+
+                        case en_stmt_needdata:
+                        case en_stmt_mustput:
+                        case en_stmt_canput:
+                                sqlstat = en_S1010;
+                                break;
+
+                        default:
+                                break;
+                }
+        }
+
+        if( sqlstat != en_00000 )
+        {
+                PUSHSQLERR ( pstmt->herr, sqlstat );
+
+                return SQL_ERROR;
+        }
+
+        hproc = _iodbcdm_getproc( pstmt->hdbc, en_SetCursorName);
+
+        if( hproc == SQL_NULL_HPROC )
+        {
+                PUSHSQLERR ( pstmt->herr, en_IM001 );
+
+                return SQL_ERROR;
+        }
+
+        CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_SetCursorName, (
+                        pstmt->dhstmt, szCursor, cbCursor ) )
 
 #if 0
-       retcode = hproc ( pstmt->dhstmt, szCursor, cbCursor );
+        retcode = hproc ( pstmt->dhstmt, szCursor, cbCursor );
 #endif
 
-       if( retcode == SQL_SUCCESS
-        || retcode == SQL_SUCCESS_WITH_INFO )
-       {
-               pstmt->cursor_state = en_stmt_cursor_named;
-       }
+        if( retcode == SQL_SUCCESS
+         || retcode == SQL_SUCCESS_WITH_INFO )
+        {
+                pstmt->cursor_state = en_stmt_cursor_named;
+        }
 
-       return retcode;
+        return retcode;
 }
 
-RETCODE SQL_API        SQLBindParameter (
-                       HSTMT           hstmt,
-                       UWORD           ipar,
-                       SWORD           fParamType,
-                       SWORD           fCType,
-                       SWORD           fSqlType,
-                       UDWORD          cbColDef,
-                       SWORD           ibScale,
-                       PTR             rgbValue,
-                       SDWORD          cbValueMax,
-                       SDWORD FAR*     pcbValue )
+RETCODE SQL_API SQLBindParameter (
+                        HSTMT           hstmt,
+                        UWORD           ipar,
+                        SWORD           fParamType,
+                        SWORD           fCType,
+                        SWORD           fSqlType,
+                        UDWORD          cbColDef,
+                        SWORD           ibScale,
+                        PTR             rgbValue,
+                        SDWORD          cbValueMax,
+                        SDWORD FAR*     pcbValue )
 {
-       STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
-       HPROC           hproc   = SQL_NULL_HPROC;
-
-       int             sqlstat = en_00000;
-       RETCODE         retcode = SQL_SUCCESS;
-
-       if( hstmt == SQL_NULL_HSTMT 
-        || pstmt->hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       /* check param */
-       if( fSqlType > SQL_TYPE_MAX
-        || ( fSqlType < SQL_TYPE_MIN 
-          && fSqlType > SQL_TYPE_DRIVER_START ) )
-       /* Note: SQL_TYPE_DRIVER_START is a nagtive number 
-        * So, we use ">" */
-       {
-               sqlstat = en_S1004;
-       }
-       else if ( ipar < 1 ) 
-       {
-               sqlstat = en_S1093;
-       }
-       else if( (rgbValue == NULL && pcbValue == NULL) 
-             && fParamType != SQL_PARAM_OUTPUT )
-       {
-               sqlstat = en_S1009;
-               /* This means, I allow output to nowhere
-                * (i.e. * junk output result). But I can't  
-                * allow input from nowhere. 
-                */ 
-       }
+        STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
+        HPROC           hproc   = SQL_NULL_HPROC;
+
+        int             sqlstat = en_00000;
+        RETCODE         retcode = SQL_SUCCESS;
+
+        if( hstmt == SQL_NULL_HSTMT
+         || pstmt->hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        /* check param */
+        if( fSqlType > SQL_TYPE_MAX
+         || ( fSqlType < SQL_TYPE_MIN
+           && fSqlType > SQL_TYPE_DRIVER_START ) )
+        /* Note: SQL_TYPE_DRIVER_START is a nagtive number
+         * So, we use ">" */
+        {
+                sqlstat = en_S1004;
+        }
+        else if ( ipar < 1 )
+        {
+                sqlstat = en_S1093;
+        }
+        else if( (rgbValue == NULL && pcbValue == NULL)
+              && fParamType != SQL_PARAM_OUTPUT )
+        {
+                sqlstat = en_S1009;
+                /* This means, I allow output to nowhere
+                 * (i.e. * junk output result). But I can't
+                 * allow input from nowhere.
+                 */
+        }
 /**********
-       else if( cbValueMax < 0L && cbValueMax != SQL_SETPARAM_VALUE_MAX )
-       {
-               sqlstat = en_S1090;
-       }
+        else if( cbValueMax < 0L && cbValueMax != SQL_SETPARAM_VALUE_MAX )
+        {
+                sqlstat = en_S1090;
+        }
 **********/
-       else if( fParamType != SQL_PARAM_INPUT
-             && fParamType != SQL_PARAM_OUTPUT
-             && fParamType != SQL_PARAM_INPUT_OUTPUT )
-       {
-               sqlstat = en_S1105;
-        }
-       else
-       {
-               switch( fCType )
-               {
-                       case SQL_C_DEFAULT:
-                       case SQL_C_CHAR:
-                       case SQL_C_BINARY:
-                       case SQL_C_BIT:
-                       case SQL_C_TINYINT:
-                       case SQL_C_STINYINT:
-                       case SQL_C_UTINYINT:
-                       case SQL_C_SHORT:
-                       case SQL_C_SSHORT:
-                       case SQL_C_USHORT:
-                       case SQL_C_LONG:
-                       case SQL_C_SLONG:
-                       case SQL_C_ULONG:
-                       case SQL_C_FLOAT:
-                       case SQL_C_DOUBLE:
-                       case SQL_C_DATE:
-                       case SQL_C_TIME:
-                       case SQL_C_TIMESTAMP:
-                               break;
-
-                       default:
-                               sqlstat = en_S1003;
-                               break;
-               }
-       }
-
-       if(sqlstat != en_00000 )
-       {
-               PUSHSQLERR ( pstmt->herr, sqlstat );
-
-               return SQL_ERROR;
-       }
-
-       /* check state */
-       if( pstmt->state >= en_stmt_needdata 
-        || pstmt->asyn_on != en_NullProc )
-       {
-               PUSHSQLERR ( pstmt->herr, en_S1010 );
-
-               retcode = SQL_ERROR;
-       }
-
-       hproc = _iodbcdm_getproc( pstmt->hdbc, en_BindParameter );
-
-       if( hproc == SQL_NULL_HPROC )
-       {
-               PUSHSQLERR ( pstmt->herr, en_IM001 );
-
-               return SQL_ERROR;
-       }
-
-       CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_BindParameter, (
-                       pstmt->dhstmt, ipar, fParamType, fCType, fSqlType, 
-                       cbColDef, ibScale, rgbValue, cbValueMax, pcbValue ) )
+        else if( fParamType != SQL_PARAM_INPUT
+              && fParamType != SQL_PARAM_OUTPUT
+              && fParamType != SQL_PARAM_INPUT_OUTPUT )
+        {
+                sqlstat = en_S1105;
+        }
+        else
+        {
+                switch( fCType )
+                {
+                        case SQL_C_DEFAULT:
+                        case SQL_C_CHAR:
+                        case SQL_C_BINARY:
+                        case SQL_C_BIT:
+                        case SQL_C_TINYINT:
+                        case SQL_C_STINYINT:
+                        case SQL_C_UTINYINT:
+                        case SQL_C_SHORT:
+                        case SQL_C_SSHORT:
+                        case SQL_C_USHORT:
+                        case SQL_C_LONG:
+                        case SQL_C_SLONG:
+                        case SQL_C_ULONG:
+                        case SQL_C_FLOAT:
+                        case SQL_C_DOUBLE:
+                        case SQL_C_DATE:
+                        case SQL_C_TIME:
+                        case SQL_C_TIMESTAMP:
+                                break;
+
+                        default:
+                                sqlstat = en_S1003;
+                                break;
+                }
+        }
+
+        if(sqlstat != en_00000 )
+        {
+                PUSHSQLERR ( pstmt->herr, sqlstat );
+
+                return SQL_ERROR;
+        }
+
+        /* check state */
+        if( pstmt->state >= en_stmt_needdata
+         || pstmt->asyn_on != en_NullProc )
+        {
+                PUSHSQLERR ( pstmt->herr, en_S1010 );
+
+                retcode = SQL_ERROR;
+        }
+
+        hproc = _iodbcdm_getproc( pstmt->hdbc, en_BindParameter );
+
+        if( hproc == SQL_NULL_HPROC )
+        {
+                PUSHSQLERR ( pstmt->herr, en_IM001 );
+
+                return SQL_ERROR;
+        }
+
+        CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_BindParameter, (
+                        pstmt->dhstmt, ipar, fParamType, fCType, fSqlType,
+                        cbColDef, ibScale, rgbValue, cbValueMax, pcbValue ) )
 
 #if 0
-       retcode = hproc(pstmt->dhstmt, ipar, fParamType, fCType, fSqlType, 
-                       cbColDef, ibScale, rgbValue, cbValueMax, pcbValue );
+        retcode = hproc(pstmt->dhstmt, ipar, fParamType, fCType, fSqlType,
+                        cbColDef, ibScale, rgbValue, cbValueMax, pcbValue );
 #endif
 
-       return retcode;
+        return retcode;
 }
 
 RETCODE SQL_API SQLParamOptions(
-                       HSTMT           hstmt,
-                       UDWORD          crow,
-                       UDWORD FAR*     pirow )
+                        HSTMT           hstmt,
+                        UDWORD          crow,
+                        UDWORD FAR*     pirow )
 {
-       STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
-       HPROC           hproc;
-       RETCODE         retcode;
-
-       if( hstmt == SQL_NULL_HSTMT 
-        || pstmt->hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
+        STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
+        HPROC           hproc;
+        RETCODE         retcode;
+
+        if( hstmt == SQL_NULL_HSTMT
+         || pstmt->hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
 
-       if( crow == (UDWORD)0UL )
-       {
-               PUSHSQLERR ( pstmt->herr, en_S1107 );
+        if( crow == (UDWORD)0UL )
+        {
+                PUSHSQLERR ( pstmt->herr, en_S1107 );
 
-               return SQL_ERROR;
-       }
+                return SQL_ERROR;
+        }
 
-       if( pstmt->state >= en_stmt_needdata
-        || pstmt->asyn_on != en_NullProc )
-       {
-               PUSHSQLERR ( pstmt->herr, en_S1010 );
+        if( pstmt->state >= en_stmt_needdata
+         || pstmt->asyn_on != en_NullProc )
+        {
+                PUSHSQLERR ( pstmt->herr, en_S1010 );
 
-               return SQL_ERROR;
-       }
+                return SQL_ERROR;
+        }
 
-       hproc = _iodbcdm_getproc ( pstmt->hdbc, en_ParamOptions );
+        hproc = _iodbcdm_getproc ( pstmt->hdbc, en_ParamOptions );
 
-       if( hproc == SQL_NULL_HPROC )
-       {
-               PUSHSQLERR ( pstmt->herr, en_IM001 );
+        if( hproc == SQL_NULL_HPROC )
+        {
+                PUSHSQLERR ( pstmt->herr, en_IM001 );
 
-               return SQL_ERROR;
-       }
+                return SQL_ERROR;
+        }
 
-       CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_ParamOptions, (
-                       pstmt->dhstmt, crow, pirow) )
+        CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_ParamOptions, (
+                        pstmt->dhstmt, crow, pirow) )
 
 #if 0
-       retcode = hproc ( pstmt->dhstmt, crow, pirow );
+        retcode = hproc ( pstmt->dhstmt, crow, pirow );
 #endif
 
-       return retcode;
+        return retcode;
 }
 
-RETCODE SQL_API        SQLSetScrollOptions( 
-                       HSTMT           hstmt,
-                       UWORD           fConcurrency,
-                       SDWORD          crowKeyset,
-                       UWORD           crowRowset )
+RETCODE SQL_API SQLSetScrollOptions(
+                        HSTMT           hstmt,
+                        UWORD           fConcurrency,
+                        SDWORD          crowKeyset,
+                        UWORD           crowRowset )
 {
-       STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
-       HPROC           hproc;
-       int             sqlstat = en_00000;
-       RETCODE         retcode;
-       
-       if( hstmt == SQL_NULL_HSTMT
-        || pstmt->hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       for(;;)
-       {
-               if( crowRowset == (UWORD)0 )
-               {
-                       sqlstat = en_S1107;
-                       break;
-               }
-
-               if( crowKeyset > (SDWORD)0L && crowKeyset < (SDWORD)crowRowset )
-               {
-                       sqlstat = en_S1107;
-                       break;
-               }
-
-               if( crowKeyset < 1 )
-               {
-                       if( crowKeyset != SQL_SCROLL_FORWARD_ONLY
-                        && crowKeyset != SQL_SCROLL_STATIC
-                        && crowKeyset != SQL_SCROLL_KEYSET_DRIVEN
-                        && crowKeyset != SQL_SCROLL_DYNAMIC )
-                       {
-                               sqlstat = en_S1107;
-                               break;
-                       }
-               }
-               
-               if( fConcurrency != SQL_CONCUR_READ_ONLY
-                && fConcurrency != SQL_CONCUR_LOCK
-                && fConcurrency != SQL_CONCUR_ROWVER
-                && fConcurrency != SQL_CONCUR_VALUES )
-               {
-                       sqlstat = en_S1108;
-                       break;
-               }
-
-               if( pstmt->state != en_stmt_allocated )
-               {
-                       sqlstat = en_S1010;
-                       break;
-               }
-
-               hproc = _iodbcdm_getproc( pstmt->hdbc, en_SetScrollOptions );
-
-               if( hproc == SQL_NULL_HPROC )
-               {
-                       sqlstat = en_IM001;
-                       break;
-               }
-
-               sqlstat = en_00000;
-               if( 1 ) /* turn off solaris warning message */
-                       break;
-       }
-
-       if( sqlstat != en_00000 )
-       {
-               PUSHSQLERR ( pstmt->herr, sqlstat );
-
-               return SQL_ERROR;
-       }
-
-       CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_SetScrollOptions, (
-                       pstmt->dhstmt, 
-                       fConcurrency, 
-                       crowKeyset,
-                       crowRowset ) )
+        STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
+        HPROC           hproc;
+        int             sqlstat = en_00000;
+        RETCODE         retcode;
+
+        if( hstmt == SQL_NULL_HSTMT
+         || pstmt->hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        for(;;)
+        {
+                if( crowRowset == (UWORD)0 )
+                {
+                        sqlstat = en_S1107;
+                        break;
+                }
+
+                if( crowKeyset > (SDWORD)0L && crowKeyset < (SDWORD)crowRowset )
+                {
+                        sqlstat = en_S1107;
+                        break;
+                }
+
+                if( crowKeyset < 1 )
+                {
+                        if( crowKeyset != SQL_SCROLL_FORWARD_ONLY
+                         && crowKeyset != SQL_SCROLL_STATIC
+                         && crowKeyset != SQL_SCROLL_KEYSET_DRIVEN
+                         && crowKeyset != SQL_SCROLL_DYNAMIC )
+                        {
+                                sqlstat = en_S1107;
+                                break;
+                        }
+                }
+
+                if( fConcurrency != SQL_CONCUR_READ_ONLY
+                 && fConcurrency != SQL_CONCUR_LOCK
+                 && fConcurrency != SQL_CONCUR_ROWVER
+                 && fConcurrency != SQL_CONCUR_VALUES )
+                {
+                        sqlstat = en_S1108;
+                        break;
+                }
+
+                if( pstmt->state != en_stmt_allocated )
+                {
+                        sqlstat = en_S1010;
+                        break;
+                }
+
+                hproc = _iodbcdm_getproc( pstmt->hdbc, en_SetScrollOptions );
+
+                if( hproc == SQL_NULL_HPROC )
+                {
+                        sqlstat = en_IM001;
+                        break;
+                }
+
+                sqlstat = en_00000;
+                if( 1 ) /* turn off solaris warning message */
+                        break;
+        }
+
+        if( sqlstat != en_00000 )
+        {
+                PUSHSQLERR ( pstmt->herr, sqlstat );
+
+                return SQL_ERROR;
+        }
+
+        CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_SetScrollOptions, (
+                        pstmt->dhstmt,
+                        fConcurrency,
+                        crowKeyset,
+                        crowRowset ) )
 
 #if 0
-       retcode = hproc(pstmt->dhstmt, 
-                       fConcurrency, 
-                       crowKeyset,
-                       crowRowset );
+        retcode = hproc(pstmt->dhstmt,
+                        fConcurrency,
+                        crowKeyset,
+                        crowRowset );
 #endif
 
-       return retcode;
+        return retcode;
 }
 
-RETCODE SQL_API        SQLSetParam (
-                       HSTMT       hstmt,
-                       UWORD       ipar,
-                       SWORD       fCType,
-                       SWORD       fSqlType,
-                       UDWORD      cbColDef,
-                       SWORD       ibScale,
-                       PTR         rgbValue,
-                       SDWORD FAR *pcbValue)
+RETCODE SQL_API SQLSetParam (
+                        HSTMT       hstmt,
+                        UWORD       ipar,
+                        SWORD       fCType,
+                        SWORD       fSqlType,
+                        UDWORD      cbColDef,
+                        SWORD       ibScale,
+                        PTR         rgbValue,
+                        SDWORD FAR *pcbValue)
 {
-       return SQLBindParameter(hstmt, 
-                               ipar, 
-                               (SWORD)SQL_PARAM_INPUT_OUTPUT,
-                               fCType,
-                               fSqlType,
-                               cbColDef,
-                               ibScale,
-                               rgbValue,
-                               SQL_SETPARAM_VALUE_MAX,
-                               pcbValue );
+        return SQLBindParameter(hstmt,
+                                ipar,
+                                (SWORD)SQL_PARAM_INPUT_OUTPUT,
+                                fCType,
+                                fSqlType,
+                                cbColDef,
+                                ibScale,
+                                rgbValue,
+                                SQL_SETPARAM_VALUE_MAX,
+                                pcbValue );
 }
index 1060d40d83594498710026cb2dfa9efa8cb35175..c00474b04f054d58c489794b91c145c9fd1092a8 100644 (file)
@@ -1,6 +1,6 @@
 /** Prepare for getting query result
-      
-    Copyright (C) 1995 by Ke Jin <kejin@empress.com> 
+
+    Copyright (C) 1995 by Ke Jin <kejin@empress.com>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 
 #include       <../iodbc/itrace.h>
 
-RETCODE SQL_API        SQLBindCol ( 
-                       HSTMT           hstmt,
-                       UWORD           icol,
-                       SWORD           fCType,
-                       PTR             rgbValue,
-                       SDWORD          cbValueMax,
-                       SDWORD FAR*     pcbValue )
+RETCODE SQL_API SQLBindCol (
+                        HSTMT           hstmt,
+                        UWORD           icol,
+                        SWORD           fCType,
+                        PTR             rgbValue,
+                        SDWORD          cbValueMax,
+                        SDWORD FAR*     pcbValue )
 {
-       STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
-       HPROC           hproc   = SQL_NULL_HPROC;
-       RETCODE         retcode;
-
-       if( hstmt == SQL_NULL_HSTMT 
-        || pstmt->hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       /* check argument */
-       switch(fCType)
-       {
-               case SQL_C_DEFAULT:
-               case SQL_C_CHAR:
-               case SQL_C_BINARY:
-               case SQL_C_BIT:
-               case SQL_C_TINYINT:
-               case SQL_C_STINYINT:
-               case SQL_C_UTINYINT:
-               case SQL_C_SHORT:
-               case SQL_C_SSHORT:
-               case SQL_C_USHORT:
-               case SQL_C_LONG:
-               case SQL_C_SLONG:
-               case SQL_C_ULONG:
-               case SQL_C_FLOAT:
-               case SQL_C_DOUBLE:
-               case SQL_C_DATE:
-               case SQL_C_TIME:
-               case SQL_C_TIMESTAMP:
-                       break;
-
-               default:
-                       PUSHSQLERR ( pstmt->herr, en_S1003);
-                       return SQL_ERROR;
-       }
-
-       if( cbValueMax < 0 )
-       {
-               PUSHSQLERR ( pstmt->herr, en_S1090 );
-               
-               return SQL_ERROR;
-       }
-
-       /* check state */
-       if( pstmt->state > en_stmt_needdata 
-        || pstmt->asyn_on != en_NullProc )
-       {
-               PUSHSQLERR ( pstmt->herr, en_S1010 );
-               return SQL_ERROR;
-       }
-
-       /* call driver's function */
-       hproc = _iodbcdm_getproc( pstmt->hdbc, en_BindCol );
-
-       if( hproc == SQL_NULL_HPROC )
-       {
-               PUSHSQLERR ( pstmt->herr, en_IM001 );
-               
-               return SQL_ERROR;
-       }
-
-       CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_BindCol, (
-                       pstmt->dhstmt, 
-                       icol, 
-                       fCType, 
-                       rgbValue, 
-                       cbValueMax,
-                       pcbValue ) )
+        STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
+        HPROC           hproc   = SQL_NULL_HPROC;
+        RETCODE         retcode;
+
+        if( hstmt == SQL_NULL_HSTMT
+         || pstmt->hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        /* check argument */
+        switch(fCType)
+        {
+                case SQL_C_DEFAULT:
+                case SQL_C_CHAR:
+                case SQL_C_BINARY:
+                case SQL_C_BIT:
+                case SQL_C_TINYINT:
+                case SQL_C_STINYINT:
+                case SQL_C_UTINYINT:
+                case SQL_C_SHORT:
+                case SQL_C_SSHORT:
+                case SQL_C_USHORT:
+                case SQL_C_LONG:
+                case SQL_C_SLONG:
+                case SQL_C_ULONG:
+                case SQL_C_FLOAT:
+                case SQL_C_DOUBLE:
+                case SQL_C_DATE:
+                case SQL_C_TIME:
+                case SQL_C_TIMESTAMP:
+                        break;
+
+                default:
+                        PUSHSQLERR ( pstmt->herr, en_S1003);
+                        return SQL_ERROR;
+        }
+
+        if( cbValueMax < 0 )
+        {
+                PUSHSQLERR ( pstmt->herr, en_S1090 );
+
+                return SQL_ERROR;
+        }
+
+        /* check state */
+        if( pstmt->state > en_stmt_needdata
+         || pstmt->asyn_on != en_NullProc )
+        {
+                PUSHSQLERR ( pstmt->herr, en_S1010 );
+                return SQL_ERROR;
+        }
+
+        /* call driver's function */
+        hproc = _iodbcdm_getproc( pstmt->hdbc, en_BindCol );
+
+        if( hproc == SQL_NULL_HPROC )
+        {
+                PUSHSQLERR ( pstmt->herr, en_IM001 );
+
+                return SQL_ERROR;
+        }
+
+        CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_BindCol, (
+                        pstmt->dhstmt,
+                        icol,
+                        fCType,
+                        rgbValue,
+                        cbValueMax,
+                        pcbValue ) )
 
 #if 0
-       retcode = hproc(pstmt->dhstmt, 
-                       icol, 
-                       fCType, 
-                       rgbValue, 
-                       cbValueMax,
-                       pcbValue );
+        retcode = hproc(pstmt->dhstmt,
+                        icol,
+                        fCType,
+                        rgbValue,
+                        cbValueMax,
+                        pcbValue );
 #endif
 
-       return retcode;
+        return retcode;
 }
 
-RETCODE SQL_API        SQLGetCursorName(
-                       HSTMT           hstmt,
-                       UCHAR FAR*      szCursor,
-                       SWORD           cbCursorMax,
-                       SWORD FAR*      pcbCursor )
+RETCODE SQL_API SQLGetCursorName(
+                        HSTMT           hstmt,
+                        UCHAR FAR*      szCursor,
+                        SWORD           cbCursorMax,
+                        SWORD FAR*      pcbCursor )
 {
-       STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
-       HPROC           hproc;
-       RETCODE         retcode;
-
-       if( hstmt == SQL_NULL_HSTMT
-        || pstmt->hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       /* check argument */
-       if( cbCursorMax < (SWORD)0 )
-       {
-               PUSHSQLERR ( pstmt->herr, en_S1090 );
-       
-               return SQL_ERROR;
-       }
-
-       /* check state */
-       if( pstmt->state >= en_stmt_needdata
-        || pstmt->asyn_on != en_NullProc )
-       {
-               PUSHSQLERR ( pstmt->herr, en_S1010 );
-
-               return SQL_ERROR;
-       }
-
-       if( pstmt->state < en_stmt_cursoropen
-        && pstmt->cursor_state == en_stmt_cursor_no )
-       {
-               PUSHSQLERR ( pstmt->herr, en_S1015 );
-
-               return SQL_ERROR;
-       }
-
-       /* call driver's function */
-       hproc = _iodbcdm_getproc ( pstmt->hdbc, en_GetCursorName );
-
-       if( hproc == SQL_NULL_HPROC )
-       {
-               PUSHSQLERR ( pstmt->herr, en_IM001 );
-
-               return SQL_ERROR;
-       }
-
-       CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_GetCursorName, (
-                       pstmt->dhstmt,
-                       szCursor,
-                       cbCursorMax,
-                       pcbCursor ) )
+        STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
+        HPROC           hproc;
+        RETCODE         retcode;
+
+        if( hstmt == SQL_NULL_HSTMT
+         || pstmt->hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        /* check argument */
+        if( cbCursorMax < (SWORD)0 )
+        {
+                PUSHSQLERR ( pstmt->herr, en_S1090 );
+
+                return SQL_ERROR;
+        }
+
+        /* check state */
+        if( pstmt->state >= en_stmt_needdata
+         || pstmt->asyn_on != en_NullProc )
+        {
+                PUSHSQLERR ( pstmt->herr, en_S1010 );
+
+                return SQL_ERROR;
+        }
+
+        if( pstmt->state < en_stmt_cursoropen
+         && pstmt->cursor_state == en_stmt_cursor_no )
+        {
+                PUSHSQLERR ( pstmt->herr, en_S1015 );
+
+                return SQL_ERROR;
+        }
+
+        /* call driver's function */
+        hproc = _iodbcdm_getproc ( pstmt->hdbc, en_GetCursorName );
+
+        if( hproc == SQL_NULL_HPROC )
+        {
+                PUSHSQLERR ( pstmt->herr, en_IM001 );
+
+                return SQL_ERROR;
+        }
+
+        CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_GetCursorName, (
+                        pstmt->dhstmt,
+                        szCursor,
+                        cbCursorMax,
+                        pcbCursor ) )
 
 #if 0
-       retcode = hproc(pstmt->dhstmt,
-                       szCursor,
-                       cbCursorMax,
-                       pcbCursor );
+        retcode = hproc(pstmt->dhstmt,
+                        szCursor,
+                        cbCursorMax,
+                        pcbCursor );
 #endif
 
-       return retcode;
+        return retcode;
 }
 
-RETCODE SQL_API        SQLRowCount( 
-                       HSTMT           hstmt,
-                       SDWORD FAR*     pcrow ) 
+RETCODE SQL_API SQLRowCount(
+                        HSTMT           hstmt,
+                        SDWORD FAR*     pcrow )
 {
-       STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
-       HPROC           hproc;
-       RETCODE         retcode;
+        STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
+        HPROC           hproc;
+        RETCODE         retcode;
 
-       if( hstmt == SQL_NULL_HSTMT 
-        || pstmt->hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
+        if( hstmt == SQL_NULL_HSTMT
+         || pstmt->hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
 
-       /* check state */
-       if( pstmt->state >= en_stmt_needdata
-        || pstmt->state <= en_stmt_prepared
-        || pstmt->asyn_on != en_NullProc )
-       {
-               PUSHSQLERR ( pstmt->herr, en_S1010 );
+        /* check state */
+        if( pstmt->state >= en_stmt_needdata
+         || pstmt->state <= en_stmt_prepared
+         || pstmt->asyn_on != en_NullProc )
+        {
+                PUSHSQLERR ( pstmt->herr, en_S1010 );
 
-               return SQL_ERROR;
-       }
+                return SQL_ERROR;
+        }
 
-       /* call driver */
-       hproc = _iodbcdm_getproc( pstmt->hdbc, en_RowCount );
+        /* call driver */
+        hproc = _iodbcdm_getproc( pstmt->hdbc, en_RowCount );
 
-       if( hproc == SQL_NULL_HPROC )
-       {
-               PUSHSQLERR ( pstmt->herr, en_IM001 );
+        if( hproc == SQL_NULL_HPROC )
+        {
+                PUSHSQLERR ( pstmt->herr, en_IM001 );
 
-               return SQL_ERROR;
-       }
+                return SQL_ERROR;
+        }
 
-       CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_RowCount, (
-                       pstmt->dhstmt, pcrow) )
+        CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_RowCount, (
+                        pstmt->dhstmt, pcrow) )
 
 #if 0
-       retcode = hproc ( pstmt->dhstmt, pcrow );
+        retcode = hproc ( pstmt->dhstmt, pcrow );
 #endif
 
-       return retcode;
+        return retcode;
 }
 
-RETCODE        SQL_API SQLNumResultCols(
-                       HSTMT           hstmt,
-                       SWORD FAR*      pccol )
+RETCODE SQL_API SQLNumResultCols(
+                        HSTMT           hstmt,
+                        SWORD FAR*      pccol )
 {
-       STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
-       HPROC           hproc;
-       RETCODE         retcode;
-       SWORD           ccol;
-
-       if( hstmt == SQL_NULL_HSTMT
-        || pstmt->hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       /* check state */
-       if( pstmt->asyn_on == en_NullProc )
-       {
-               if( pstmt->state == en_stmt_allocated
-                || pstmt->state >= en_stmt_needdata )
-               {
-                       PUSHSQLERR ( pstmt->herr, en_S1010 );
-                       return SQL_ERROR;
-               }
-       }
-       else if( pstmt->asyn_on != en_NumResultCols )
-       {
-               PUSHSQLERR ( pstmt->herr, en_S1010 );
-
-               return SQL_ERROR;
-       }
-
-       /* call driver */
-       hproc = _iodbcdm_getproc( pstmt->hdbc, en_NumResultCols );
-
-       if( hproc == SQL_NULL_HPROC )
-       {
-               PUSHSQLERR ( pstmt->herr, en_IM001 );
-
-               return SQL_ERROR;
-       }
-
-       CALL_DRIVER ( pstmt->hdbc,  retcode, hproc, en_NumResultCols, (
-                       pstmt->dhstmt, &ccol) )
+        STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
+        HPROC           hproc;
+        RETCODE         retcode;
+        SWORD           ccol;
+
+        if( hstmt == SQL_NULL_HSTMT
+         || pstmt->hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        /* check state */
+        if( pstmt->asyn_on == en_NullProc )
+        {
+                if( pstmt->state == en_stmt_allocated
+                 || pstmt->state >= en_stmt_needdata )
+                {
+                        PUSHSQLERR ( pstmt->herr, en_S1010 );
+                        return SQL_ERROR;
+                }
+        }
+        else if( pstmt->asyn_on != en_NumResultCols )
+        {
+                PUSHSQLERR ( pstmt->herr, en_S1010 );
+
+                return SQL_ERROR;
+        }
+
+        /* call driver */
+        hproc = _iodbcdm_getproc( pstmt->hdbc, en_NumResultCols );
+
+        if( hproc == SQL_NULL_HPROC )
+        {
+                PUSHSQLERR ( pstmt->herr, en_IM001 );
+
+                return SQL_ERROR;
+        }
+
+        CALL_DRIVER ( pstmt->hdbc,  retcode, hproc, en_NumResultCols, (
+                        pstmt->dhstmt, &ccol) )
 
 #if 0
-       retcode = hproc( pstmt->dhstmt, &ccol );
+        retcode = hproc( pstmt->dhstmt, &ccol );
 #endif
 
-       /* state transition */
-       if( pstmt->asyn_on == en_NumResultCols )
-       {
-               switch( retcode )
-               {
-                       case SQL_SUCCESS:
-                       case SQL_SUCCESS_WITH_INFO:
-                       case SQL_ERROR:
-                               pstmt->asyn_on = en_NullProc;
-
-                       case SQL_STILL_EXECUTING:
-                       default:
-                               break;
-               }
-       }
-
-       switch( retcode )
-       {
-               case SQL_SUCCESS:
-               case SQL_SUCCESS_WITH_INFO:
-                       break;
-
-               case SQL_STILL_EXECUTING:
-                       ccol = 0;
-                       pstmt->asyn_on = en_NumResultCols;
-                       break;
-
-               default:
-                       ccol = 0;
-                       break;
-       }
-
-       if( pccol )
-       {
-               *pccol = ccol;
-       }
-
-       return retcode;
+        /* state transition */
+        if( pstmt->asyn_on == en_NumResultCols )
+        {
+                switch( retcode )
+                {
+                        case SQL_SUCCESS:
+                        case SQL_SUCCESS_WITH_INFO:
+                        case SQL_ERROR:
+                                pstmt->asyn_on = en_NullProc;
+
+                        case SQL_STILL_EXECUTING:
+                        default:
+                                break;
+                }
+        }
+
+        switch( retcode )
+        {
+                case SQL_SUCCESS:
+                case SQL_SUCCESS_WITH_INFO:
+                        break;
+
+                case SQL_STILL_EXECUTING:
+                        ccol = 0;
+                        pstmt->asyn_on = en_NumResultCols;
+                        break;
+
+                default:
+                        ccol = 0;
+                        break;
+        }
+
+        if( pccol )
+        {
+                *pccol = ccol;
+        }
+
+        return retcode;
 }
 
-RETCODE SQL_API        SQLDescribeCol( 
-                       HSTMT           hstmt,
-                       UWORD           icol,
-                       UCHAR  FAR*     szColName,
-                       SWORD           cbColNameMax,
-                       SWORD  FAR*     pcbColName,
-                       SWORD  FAR*     pfSqlType,
-                       UDWORD FAR*     pcbColDef,
-                       SWORD  FAR*     pibScale,
-                       SWORD  FAR*     pfNullable )
+RETCODE SQL_API SQLDescribeCol(
+                        HSTMT           hstmt,
+                        UWORD           icol,
+                        UCHAR  FAR*     szColName,
+                        SWORD           cbColNameMax,
+                        SWORD  FAR*     pcbColName,
+                        SWORD  FAR*     pfSqlType,
+                        UDWORD FAR*     pcbColDef,
+                        SWORD  FAR*     pibScale,
+                        SWORD  FAR*     pfNullable )
 {
-       STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
-       HPROC           hproc;
-       RETCODE         retcode;
-       int             sqlstat = en_00000;
-
-       if( hstmt == SQL_NULL_HSTMT
-        || pstmt->hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       /* check arguments */
-       if( icol == 0 )
-       {
-               sqlstat = en_S1002;
-       }
-       else if( cbColNameMax < 0 )
-       {
-               sqlstat = en_S1090;
-       }
-
-       if( sqlstat != en_00000 )
-       {
-               PUSHSQLERR ( pstmt->herr, sqlstat );
-
-               return SQL_ERROR;
-       }
-
-       /* check state */
-       if( pstmt->asyn_on == en_NullProc )
-       {
-               if( pstmt->asyn_on == en_stmt_allocated 
-                || pstmt->asyn_on >= en_stmt_needdata )
-               {
-                       sqlstat = en_S1010;
-               }
-       }
-       else if( pstmt->asyn_on != en_DescribeCol )
-       {
-               sqlstat = en_S1010;
-       }
-
-       if( sqlstat != en_00000 )
-       {
-               PUSHSQLERR ( pstmt->herr, sqlstat );
-
-               return SQL_ERROR;
-       }
-
-       /* call driver */
-       hproc = _iodbcdm_getproc( pstmt->hdbc, en_DescribeCol );
-
-       if( hproc == SQL_NULL_HPROC )
-       {
-               PUSHSQLERR ( pstmt->herr, en_IM001 );
-
-               return SQL_ERROR;
-       }
-
-       CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_DescribeCol, (
-                       pstmt->dhstmt,
-                       icol,
-                       szColName,
-                       cbColNameMax,
-                       pcbColName,
-                       pfSqlType,
-                       pcbColDef,
-                       pibScale,
-                       pfNullable) )
+        STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
+        HPROC           hproc;
+        RETCODE         retcode;
+        int             sqlstat = en_00000;
+
+        if( hstmt == SQL_NULL_HSTMT
+         || pstmt->hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        /* check arguments */
+        if( icol == 0 )
+        {
+                sqlstat = en_S1002;
+        }
+        else if( cbColNameMax < 0 )
+        {
+                sqlstat = en_S1090;
+        }
+
+        if( sqlstat != en_00000 )
+        {
+                PUSHSQLERR ( pstmt->herr, sqlstat );
+
+                return SQL_ERROR;
+        }
+
+        /* check state */
+        if( pstmt->asyn_on == en_NullProc )
+        {
+                if( pstmt->asyn_on == en_stmt_allocated
+                 || pstmt->asyn_on >= en_stmt_needdata )
+                {
+                        sqlstat = en_S1010;
+                }
+        }
+        else if( pstmt->asyn_on != en_DescribeCol )
+        {
+                sqlstat = en_S1010;
+        }
+
+        if( sqlstat != en_00000 )
+        {
+                PUSHSQLERR ( pstmt->herr, sqlstat );
+
+                return SQL_ERROR;
+        }
+
+        /* call driver */
+        hproc = _iodbcdm_getproc( pstmt->hdbc, en_DescribeCol );
+
+        if( hproc == SQL_NULL_HPROC )
+        {
+                PUSHSQLERR ( pstmt->herr, en_IM001 );
+
+                return SQL_ERROR;
+        }
+
+        CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_DescribeCol, (
+                        pstmt->dhstmt,
+                        icol,
+                        szColName,
+                        cbColNameMax,
+                        pcbColName,
+                        pfSqlType,
+                        pcbColDef,
+                        pibScale,
+                        pfNullable) )
 
 #if 0
-       retcode = hproc(pstmt->dhstmt,
-                       icol,
-                       szColName,
-                       cbColNameMax,
-                       pcbColName,
-                       pfSqlType,
-                       pcbColDef,
-                       pibScale,
-                       pfNullable );
+        retcode = hproc(pstmt->dhstmt,
+                        icol,
+                        szColName,
+                        cbColNameMax,
+                        pcbColName,
+                        pfSqlType,
+                        pcbColDef,
+                        pibScale,
+                        pfNullable );
 #endif
 
-       /* state transition */
-       if( pstmt->asyn_on == en_DescribeCol )
-       {
-               switch( retcode )
-               {
-                       case SQL_SUCCESS:
-                       case SQL_SUCCESS_WITH_INFO:
-                       case SQL_ERROR:
-                               pstmt->asyn_on = en_NullProc;
-                               break;
-
-                       default:
-                               return retcode;
-               }
-       }
-
-       switch( pstmt->state )
-       {
-               case en_stmt_prepared:
-               case en_stmt_cursoropen:
-               case en_stmt_fetched:
-               case en_stmt_xfetched:
-                       if( retcode == SQL_STILL_EXECUTING )
-                       {
-                               pstmt->asyn_on = en_DescribeCol;
-                       }
-                       break;
-
-               default:
-                       break;
-       }
-
-       return retcode;
+        /* state transition */
+        if( pstmt->asyn_on == en_DescribeCol )
+        {
+                switch( retcode )
+                {
+                        case SQL_SUCCESS:
+                        case SQL_SUCCESS_WITH_INFO:
+                        case SQL_ERROR:
+                                pstmt->asyn_on = en_NullProc;
+                                break;
+
+                        default:
+                                return retcode;
+                }
+        }
+
+        switch( pstmt->state )
+        {
+                case en_stmt_prepared:
+                case en_stmt_cursoropen:
+                case en_stmt_fetched:
+                case en_stmt_xfetched:
+                        if( retcode == SQL_STILL_EXECUTING )
+                        {
+                                pstmt->asyn_on = en_DescribeCol;
+                        }
+                        break;
+
+                default:
+                        break;
+        }
+
+        return retcode;
 }
 
-RETCODE SQL_API        SQLColAttributes( 
-                       HSTMT           hstmt,
-                       UWORD           icol,
-                       UWORD           fDescType,
-                       PTR             rgbDesc,
-                       SWORD           cbDescMax,
-                       SWORD  FAR*     pcbDesc,
-                       SDWORD FAR*     pfDesc )
+RETCODE SQL_API SQLColAttributes(
+                        HSTMT           hstmt,
+                        UWORD           icol,
+                        UWORD           fDescType,
+                        PTR             rgbDesc,
+                        SWORD           cbDescMax,
+                        SWORD  FAR*     pcbDesc,
+                        SDWORD FAR*     pfDesc )
 {
-       STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
-       HPROC           hproc;
-       RETCODE         retcode;
-       int             sqlstat = en_00000;
-
-       if( hstmt == SQL_NULL_HSTMT
-        || pstmt->hdbc == SQL_NULL_HDBC )
-       {
-               return SQL_INVALID_HANDLE;
-       }
-
-       /* check arguments */
-       if( icol == 0 && fDescType != SQL_COLUMN_COUNT )
-       {
-               sqlstat = en_S1002;
-       }
-       else if( cbDescMax < 0 )
-       {
-               sqlstat = en_S1090;
-       }
-       else if(/* fDescType < SQL_COLATT_OPT_MIN || */ /* turnoff warning */
-                ( fDescType > SQL_COLATT_OPT_MAX 
-               && fDescType < SQL_COLUMN_DRIVER_START ) )
-       {
-               sqlstat = en_S1091;
-       }
-
-       if( sqlstat != en_00000 )
-       {
-               PUSHSQLERR ( pstmt->herr, sqlstat );
-
-               return SQL_ERROR;
-       }
-
-       /* check state */
-       if( pstmt->asyn_on == en_NullProc )
-       {
-               if( pstmt->asyn_on == en_stmt_allocated 
-                || pstmt->asyn_on >= en_stmt_needdata )
-               {
-                       sqlstat = en_S1010;
-               }
-       }
-       else if( pstmt->asyn_on != en_ColAttributes )
-       {
-               sqlstat = en_S1010;
-       }
-
-       if( sqlstat != en_00000 )
-       {
-               PUSHSQLERR ( pstmt->herr, sqlstat );
-
-               return SQL_ERROR;
-       }
-
-       /* call driver */
-       hproc = _iodbcdm_getproc( pstmt->hdbc, en_ColAttributes );
-
-       if( hproc == SQL_NULL_HPROC )
-       {
-               PUSHSQLERR ( pstmt->herr, en_IM001 );
-
-               return SQL_ERROR;
-       }
-
-       CALL_DRIVER ( pstmt->hdbc,  retcode, hproc, en_ColAttributes, (
-                       pstmt->dhstmt,
-                       icol,
-                       fDescType,
-                       rgbDesc,
-                       cbDescMax,
-                       pcbDesc,
-                       pfDesc) )
+        STMT_t FAR*     pstmt   = (STMT_t FAR*)hstmt;
+        HPROC           hproc;
+        RETCODE         retcode;
+        int             sqlstat = en_00000;
+
+        if( hstmt == SQL_NULL_HSTMT
+         || pstmt->hdbc == SQL_NULL_HDBC )
+        {
+                return SQL_INVALID_HANDLE;
+        }
+
+        /* check arguments */
+        if( icol == 0 && fDescType != SQL_COLUMN_COUNT )
+        {
+                sqlstat = en_S1002;
+        }
+        else if( cbDescMax < 0 )
+        {
+                sqlstat = en_S1090;
+        }
+        else if(/* fDescType < SQL_COLATT_OPT_MIN || */ /* turnoff warning */
+                 ( fDescType > SQL_COLATT_OPT_MAX
+                && fDescType < SQL_COLUMN_DRIVER_START ) )
+        {
+                sqlstat = en_S1091;
+        }
+
+        if( sqlstat != en_00000 )
+        {
+                PUSHSQLERR ( pstmt->herr, sqlstat );
+
+                return SQL_ERROR;
+        }
+
+        /* check state */
+        if( pstmt->asyn_on == en_NullProc )
+        {
+                if( pstmt->asyn_on == en_stmt_allocated
+                 || pstmt->asyn_on >= en_stmt_needdata )
+                {
+                        sqlstat = en_S1010;
+                }
+        }
+        else if( pstmt->asyn_on != en_ColAttributes )
+        {
+                sqlstat = en_S1010;
+        }
+
+        if( sqlstat != en_00000 )
+        {
+                PUSHSQLERR ( pstmt->herr, sqlstat );
+
+                return SQL_ERROR;
+        }
+
+        /* call driver */
+        hproc = _iodbcdm_getproc( pstmt->hdbc, en_ColAttributes );
+
+        if( hproc == SQL_NULL_HPROC )
+        {
+                PUSHSQLERR ( pstmt->herr, en_IM001 );
+
+                return SQL_ERROR;
+        }
+
+        CALL_DRIVER ( pstmt->hdbc,  retcode, hproc, en_ColAttributes, (
+                        pstmt->dhstmt,
+                        icol,
+                        fDescType,
+                        rgbDesc,
+                        cbDescMax,
+                        pcbDesc,
+                        pfDesc) )
 
 #if 0
-       retcode = hproc(pstmt->dhstmt,
-                       icol,
-                       fDescType,
-                       rgbDesc,
-                       cbDescMax,
-                       pcbDesc,
-                       pfDesc );
+        retcode = hproc(pstmt->dhstmt,
+                        icol,
+                        fDescType,
+                        rgbDesc,
+                        cbDescMax,
+                        pcbDesc,
+                        pfDesc );
 #endif
 
-       /* state transition */
-       if( pstmt->asyn_on == en_ColAttributes )
-       {
-               switch( retcode )
-               {
-                       case SQL_SUCCESS:
-                       case SQL_SUCCESS_WITH_INFO:
-                       case SQL_ERROR:
-                               pstmt->asyn_on = en_NullProc;
-                               break;
-
-                       default:
-                               return retcode;
-               }
-       }
-
-       switch( pstmt->state )
-       {
-               case en_stmt_prepared:
-               case en_stmt_cursoropen:
-               case en_stmt_fetched:
-               case en_stmt_xfetched:
-                       if( retcode == SQL_STILL_EXECUTING )
-                       {
-                               pstmt->asyn_on = en_ColAttributes;
-                       }
-                       break;
-
-               default:
-                       break;
-       }
-
-       return retcode;
+        /* state transition */
+        if( pstmt->asyn_on == en_ColAttributes )
+        {
+                switch( retcode )
+                {
+                        case SQL_SUCCESS:
+                        case SQL_SUCCESS_WITH_INFO:
+                        case SQL_ERROR:
+                                pstmt->asyn_on = en_NullProc;
+                                break;
+
+                        default:
+                                return retcode;
+                }
+        }
+
+        switch( pstmt->state )
+        {
+                case en_stmt_prepared:
+                case en_stmt_cursoropen:
+                case en_stmt_fetched:
+                case en_stmt_xfetched:
+                        if( retcode == SQL_STILL_EXECUTING )
+                        {
+                                pstmt->asyn_on = en_ColAttributes;
+                        }
+                        break;
+
+                default:
+                        break;
+        }
+
+        return retcode;
 }
index bf32323d91b54e7f43d2c33e1a0f0dd68ab52484..1fe3ec7de9489d9c20554fb43d98d622d0f5edd7 100644 (file)
@@ -41,7 +41,7 @@ SQLFetch
 SQLExtendedFetch
 SQLGetData
 SQLSetPos
-SQLMoreResults         
+SQLMoreResults
 SQLError
 
 SQLColumnPrivileges