iODBC v2.5
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1446 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
504
configure
vendored
504
configure
vendored
@@ -4296,6 +4296,340 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
DL_LIBRARY=
|
||||||
|
for ac_func in dlopen
|
||||||
|
do
|
||||||
|
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||||
|
echo "configure:4304: checking for $ac_func" >&5
|
||||||
|
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
||||||
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
|
else
|
||||||
|
cat > conftest.$ac_ext <<EOF
|
||||||
|
#line 4309 "configure"
|
||||||
|
#include "confdefs.h"
|
||||||
|
/* System header to define __stub macros and hopefully few prototypes,
|
||||||
|
which can conflict with char $ac_func(); below. */
|
||||||
|
#include <assert.h>
|
||||||
|
/* Override any gcc2 internal prototype to avoid an error. */
|
||||||
|
/* We use char because int might match the return type of a gcc2
|
||||||
|
builtin and then its argument prototype would still apply. */
|
||||||
|
char $ac_func();
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
|
||||||
|
/* The GNU C library defines this for functions which it implements
|
||||||
|
to always fail with ENOSYS. Some functions are actually named
|
||||||
|
something starting with __ and the normal name is an alias. */
|
||||||
|
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
|
||||||
|
choke me
|
||||||
|
#else
|
||||||
|
$ac_func();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
; return 0; }
|
||||||
|
EOF
|
||||||
|
if { (eval echo configure:4332: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
||||||
|
rm -rf conftest*
|
||||||
|
eval "ac_cv_func_$ac_func=yes"
|
||||||
|
else
|
||||||
|
echo "configure: failed program was:" >&5
|
||||||
|
cat conftest.$ac_ext >&5
|
||||||
|
rm -rf conftest*
|
||||||
|
eval "ac_cv_func_$ac_func=no"
|
||||||
|
fi
|
||||||
|
rm -f conftest*
|
||||||
|
fi
|
||||||
|
|
||||||
|
if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
|
||||||
|
echo "$ac_t""yes" 1>&6
|
||||||
|
ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
|
||||||
|
cat >> confdefs.h <<EOF
|
||||||
|
#define $ac_tr_func 1
|
||||||
|
EOF
|
||||||
|
cat >> confdefs.h <<\EOF
|
||||||
|
#define HAVE_LIBDL 1
|
||||||
|
EOF
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "$ac_t""no" 1>&6
|
||||||
|
echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
|
||||||
|
echo "configure:4357: checking for dlopen in -ldl" >&5
|
||||||
|
ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
|
||||||
|
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||||
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
|
else
|
||||||
|
ac_save_LIBS="$LIBS"
|
||||||
|
LIBS="-ldl $LIBS"
|
||||||
|
cat > conftest.$ac_ext <<EOF
|
||||||
|
#line 4365 "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
|
||||||
|
builtin and then its argument prototype would still apply. */
|
||||||
|
char dlopen();
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
dlopen()
|
||||||
|
; return 0; }
|
||||||
|
EOF
|
||||||
|
if { (eval echo configure:4376: \"$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
|
||||||
|
echo "configure: failed program was:" >&5
|
||||||
|
cat conftest.$ac_ext >&5
|
||||||
|
rm -rf conftest*
|
||||||
|
eval "ac_cv_lib_$ac_lib_var=no"
|
||||||
|
fi
|
||||||
|
rm -f conftest*
|
||||||
|
LIBS="$ac_save_LIBS"
|
||||||
|
|
||||||
|
fi
|
||||||
|
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
|
||||||
|
echo "$ac_t""yes" 1>&6
|
||||||
|
cat >> confdefs.h <<\EOF
|
||||||
|
#define HAVE_LIBDL 1
|
||||||
|
EOF
|
||||||
|
DL_LIBRARY="-ldl"
|
||||||
|
else
|
||||||
|
echo "$ac_t""no" 1>&6
|
||||||
|
echo $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6
|
||||||
|
echo "configure:4398: checking for dld_link in -ldld" >&5
|
||||||
|
ac_lib_var=`echo dld'_'dld_link | sed 'y%./+-%__p_%'`
|
||||||
|
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||||
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
|
else
|
||||||
|
ac_save_LIBS="$LIBS"
|
||||||
|
LIBS="-ldld $LIBS"
|
||||||
|
cat > conftest.$ac_ext <<EOF
|
||||||
|
#line 4406 "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
|
||||||
|
builtin and then its argument prototype would still apply. */
|
||||||
|
char dld_link();
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
dld_link()
|
||||||
|
; return 0; }
|
||||||
|
EOF
|
||||||
|
if { (eval echo configure:4417: \"$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
|
||||||
|
echo "configure: failed program was:" >&5
|
||||||
|
cat conftest.$ac_ext >&5
|
||||||
|
rm -rf conftest*
|
||||||
|
eval "ac_cv_lib_$ac_lib_var=no"
|
||||||
|
fi
|
||||||
|
rm -f conftest*
|
||||||
|
LIBS="$ac_save_LIBS"
|
||||||
|
|
||||||
|
fi
|
||||||
|
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
|
||||||
|
echo "$ac_t""yes" 1>&6
|
||||||
|
cat >> confdefs.h <<\EOF
|
||||||
|
#define HAVE_DLD 1
|
||||||
|
EOF
|
||||||
|
DL_LIBRARY="-ldld"
|
||||||
|
else
|
||||||
|
echo "$ac_t""no" 1>&6
|
||||||
|
for ac_func in shl_load
|
||||||
|
do
|
||||||
|
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||||
|
echo "configure:4441: checking for $ac_func" >&5
|
||||||
|
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
||||||
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
|
else
|
||||||
|
cat > conftest.$ac_ext <<EOF
|
||||||
|
#line 4446 "configure"
|
||||||
|
#include "confdefs.h"
|
||||||
|
/* System header to define __stub macros and hopefully few prototypes,
|
||||||
|
which can conflict with char $ac_func(); below. */
|
||||||
|
#include <assert.h>
|
||||||
|
/* Override any gcc2 internal prototype to avoid an error. */
|
||||||
|
/* We use char because int might match the return type of a gcc2
|
||||||
|
builtin and then its argument prototype would still apply. */
|
||||||
|
char $ac_func();
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
|
||||||
|
/* The GNU C library defines this for functions which it implements
|
||||||
|
to always fail with ENOSYS. Some functions are actually named
|
||||||
|
something starting with __ and the normal name is an alias. */
|
||||||
|
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
|
||||||
|
choke me
|
||||||
|
#else
|
||||||
|
$ac_func();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
; return 0; }
|
||||||
|
EOF
|
||||||
|
if { (eval echo configure:4469: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
||||||
|
rm -rf conftest*
|
||||||
|
eval "ac_cv_func_$ac_func=yes"
|
||||||
|
else
|
||||||
|
echo "configure: failed program was:" >&5
|
||||||
|
cat conftest.$ac_ext >&5
|
||||||
|
rm -rf conftest*
|
||||||
|
eval "ac_cv_func_$ac_func=no"
|
||||||
|
fi
|
||||||
|
rm -f conftest*
|
||||||
|
fi
|
||||||
|
|
||||||
|
if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
|
||||||
|
echo "$ac_t""yes" 1>&6
|
||||||
|
ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
|
||||||
|
cat >> confdefs.h <<EOF
|
||||||
|
#define $ac_tr_func 1
|
||||||
|
EOF
|
||||||
|
cat >> confdefs.h <<\EOF
|
||||||
|
#define HAVE_SHL_LOAD 1
|
||||||
|
EOF
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "$ac_t""no" 1>&6
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
echo $ac_n "checking for underscore before symbols""... $ac_c" 1>&6
|
||||||
|
echo "configure:4509: checking for underscore before symbols" >&5
|
||||||
|
if eval "test \"`echo '$''{'libltdl_cv_uscore'+set}'`\" = set"; then
|
||||||
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
|
else
|
||||||
|
|
||||||
|
echo "main(){int i=1;} fnord(){int i=23; int ltuae=42;}" > conftest.c
|
||||||
|
${CC} -c conftest.c > /dev/null
|
||||||
|
if (nm conftest.o | grep _fnord) > /dev/null; then
|
||||||
|
libltdl_cv_uscore=yes
|
||||||
|
else
|
||||||
|
libltdl_cv_uscore=no
|
||||||
|
fi
|
||||||
|
rm -f conftest*
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$ac_t""$libltdl_cv_uscore" 1>&6
|
||||||
|
|
||||||
|
if test x"$libltdl_cv_uscore" = xyes; then
|
||||||
|
if test x"$ac_cv_func_dlopen" = xyes ||
|
||||||
|
test x"$ac_cv_lib_dl_dlopen" = xyes ; then
|
||||||
|
echo $ac_n "checking whether we have to add an underscore for dlsym""... $ac_c" 1>&6
|
||||||
|
echo "configure:4531: checking whether we have to add an underscore for dlsym" >&5
|
||||||
|
if eval "test \"`echo '$''{'libltdl_cv_need_uscore'+set}'`\" = set"; then
|
||||||
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
|
else
|
||||||
|
if test "$cross_compiling" = yes; then
|
||||||
|
libltdl_cv_need_uscore=no
|
||||||
|
|
||||||
|
else
|
||||||
|
cat > conftest.$ac_ext <<EOF
|
||||||
|
#line 4540 "configure"
|
||||||
|
#include "confdefs.h"
|
||||||
|
|
||||||
|
#include <dlfcn.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
fnord() { int i=42;}
|
||||||
|
main() { void *self, *ptr1, *ptr2; self=dlopen(NULL,RTLD_LAZY);
|
||||||
|
if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
|
||||||
|
if(ptr1 && !ptr2) exit(0); } exit(1); }
|
||||||
|
|
||||||
|
EOF
|
||||||
|
if { (eval echo configure:4551: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
|
||||||
|
then
|
||||||
|
libltdl_cv_need_uscore=no
|
||||||
|
else
|
||||||
|
echo "configure: failed program was:" >&5
|
||||||
|
cat conftest.$ac_ext >&5
|
||||||
|
rm -fr conftest*
|
||||||
|
libltdl_cv_need_uscore=yes
|
||||||
|
fi
|
||||||
|
rm -fr conftest*
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$ac_t""$libltdl_cv_need_uscore" 1>&6
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test x"$libltdl_cv_need_uscore" = xyes; then
|
||||||
|
cat >> confdefs.h <<\EOF
|
||||||
|
#define NEED_USCORE 1
|
||||||
|
EOF
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
for ac_func in strerror
|
||||||
|
do
|
||||||
|
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||||
|
echo "configure:4580: checking for $ac_func" >&5
|
||||||
|
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
|
||||||
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
|
else
|
||||||
|
cat > conftest.$ac_ext <<EOF
|
||||||
|
#line 4585 "configure"
|
||||||
|
#include "confdefs.h"
|
||||||
|
/* System header to define __stub macros and hopefully few prototypes,
|
||||||
|
which can conflict with char $ac_func(); below. */
|
||||||
|
#include <assert.h>
|
||||||
|
/* Override any gcc2 internal prototype to avoid an error. */
|
||||||
|
/* We use char because int might match the return type of a gcc2
|
||||||
|
builtin and then its argument prototype would still apply. */
|
||||||
|
char $ac_func();
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
|
||||||
|
/* The GNU C library defines this for functions which it implements
|
||||||
|
to always fail with ENOSYS. Some functions are actually named
|
||||||
|
something starting with __ and the normal name is an alias. */
|
||||||
|
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
|
||||||
|
choke me
|
||||||
|
#else
|
||||||
|
$ac_func();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
; return 0; }
|
||||||
|
EOF
|
||||||
|
if { (eval echo configure:4608: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
||||||
|
rm -rf conftest*
|
||||||
|
eval "ac_cv_func_$ac_func=yes"
|
||||||
|
else
|
||||||
|
echo "configure: failed program was:" >&5
|
||||||
|
cat conftest.$ac_ext >&5
|
||||||
|
rm -rf conftest*
|
||||||
|
eval "ac_cv_func_$ac_func=no"
|
||||||
|
fi
|
||||||
|
rm -f conftest*
|
||||||
|
fi
|
||||||
|
|
||||||
|
if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
|
||||||
|
echo "$ac_t""yes" 1>&6
|
||||||
|
ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
|
||||||
|
cat >> confdefs.h <<EOF
|
||||||
|
#define $ac_tr_func 1
|
||||||
|
EOF
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "$ac_t""no" 1>&6
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CHECK_INCLUDE="-I/usr/include $X_CFLAGS"
|
CHECK_INCLUDE="-I/usr/include $X_CFLAGS"
|
||||||
CHECK_LIB="-L/lib -L/usr/lib $X_LIBS"
|
CHECK_LIB="-L/lib -L/usr/lib $X_LIBS"
|
||||||
|
|
||||||
@@ -4307,7 +4641,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo $ac_n "checking host system type""... $ac_c" 1>&6
|
echo $ac_n "checking host system type""... $ac_c" 1>&6
|
||||||
echo "configure:4311: checking host system type" >&5
|
echo "configure:4645: checking host system type" >&5
|
||||||
|
|
||||||
host_alias=$host
|
host_alias=$host
|
||||||
case "$host_alias" in
|
case "$host_alias" in
|
||||||
@@ -4550,7 +4884,7 @@ DEFAULT_wxUSE_WCSRTOMBS=0
|
|||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking "for gtk"""... $ac_c" 1>&6
|
echo $ac_n "checking "for gtk"""... $ac_c" 1>&6
|
||||||
echo "configure:4554: checking "for gtk"" >&5
|
echo "configure:4888: checking "for gtk"" >&5
|
||||||
# Check whether --with-gtk or --without-gtk was given.
|
# Check whether --with-gtk or --without-gtk was given.
|
||||||
if test "${with_gtk+set}" = set; then
|
if test "${with_gtk+set}" = set; then
|
||||||
withval="$with_gtk"
|
withval="$with_gtk"
|
||||||
@@ -4580,7 +4914,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking "for qt"""... $ac_c" 1>&6
|
echo $ac_n "checking "for qt"""... $ac_c" 1>&6
|
||||||
echo "configure:4584: checking "for qt"" >&5
|
echo "configure:4918: checking "for qt"" >&5
|
||||||
# Check whether --with-qt or --without-qt was given.
|
# Check whether --with-qt or --without-qt was given.
|
||||||
if test "${with_qt+set}" = set; then
|
if test "${with_qt+set}" = set; then
|
||||||
withval="$with_qt"
|
withval="$with_qt"
|
||||||
@@ -4610,7 +4944,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking "for motif"""... $ac_c" 1>&6
|
echo $ac_n "checking "for motif"""... $ac_c" 1>&6
|
||||||
echo "configure:4614: checking "for motif"" >&5
|
echo "configure:4948: checking "for motif"" >&5
|
||||||
# Check whether --with-motif or --without-motif was given.
|
# Check whether --with-motif or --without-motif was given.
|
||||||
if test "${with_motif+set}" = set; then
|
if test "${with_motif+set}" = set; then
|
||||||
withval="$with_motif"
|
withval="$with_motif"
|
||||||
@@ -4641,7 +4975,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking "for shared"""... $ac_c" 1>&6
|
echo $ac_n "checking "for shared"""... $ac_c" 1>&6
|
||||||
echo "configure:4645: checking "for shared"" >&5
|
echo "configure:4979: checking "for shared"" >&5
|
||||||
# Check whether --with-shared or --without-shared was given.
|
# Check whether --with-shared or --without-shared was given.
|
||||||
if test "${with_shared+set}" = set; then
|
if test "${with_shared+set}" = set; then
|
||||||
withval="$with_shared"
|
withval="$with_shared"
|
||||||
@@ -4671,7 +5005,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking "for optimise"""... $ac_c" 1>&6
|
echo $ac_n "checking "for optimise"""... $ac_c" 1>&6
|
||||||
echo "configure:4675: checking "for optimise"" >&5
|
echo "configure:5009: checking "for optimise"" >&5
|
||||||
# Check whether --with-optimise or --without-optimise was given.
|
# Check whether --with-optimise or --without-optimise was given.
|
||||||
if test "${with_optimise+set}" = set; then
|
if test "${with_optimise+set}" = set; then
|
||||||
withval="$with_optimise"
|
withval="$with_optimise"
|
||||||
@@ -4701,7 +5035,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking "for debug_flag"""... $ac_c" 1>&6
|
echo $ac_n "checking "for debug_flag"""... $ac_c" 1>&6
|
||||||
echo "configure:4705: checking "for debug_flag"" >&5
|
echo "configure:5039: checking "for debug_flag"" >&5
|
||||||
# Check whether --with-debug_flag or --without-debug_flag was given.
|
# Check whether --with-debug_flag or --without-debug_flag was given.
|
||||||
if test "${with_debug_flag+set}" = set; then
|
if test "${with_debug_flag+set}" = set; then
|
||||||
withval="$with_debug_flag"
|
withval="$with_debug_flag"
|
||||||
@@ -4731,7 +5065,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking "for debug_info"""... $ac_c" 1>&6
|
echo $ac_n "checking "for debug_info"""... $ac_c" 1>&6
|
||||||
echo "configure:4735: checking "for debug_info"" >&5
|
echo "configure:5069: checking "for debug_info"" >&5
|
||||||
# Check whether --with-debug_info or --without-debug_info was given.
|
# Check whether --with-debug_info or --without-debug_info was given.
|
||||||
if test "${with_debug_info+set}" = set; then
|
if test "${with_debug_info+set}" = set; then
|
||||||
withval="$with_debug_info"
|
withval="$with_debug_info"
|
||||||
@@ -4761,7 +5095,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking "for debug_gdb"""... $ac_c" 1>&6
|
echo $ac_n "checking "for debug_gdb"""... $ac_c" 1>&6
|
||||||
echo "configure:4765: checking "for debug_gdb"" >&5
|
echo "configure:5099: checking "for debug_gdb"" >&5
|
||||||
# Check whether --with-debug_gdb or --without-debug_gdb was given.
|
# Check whether --with-debug_gdb or --without-debug_gdb was given.
|
||||||
if test "${with_debug_gdb+set}" = set; then
|
if test "${with_debug_gdb+set}" = set; then
|
||||||
withval="$with_debug_gdb"
|
withval="$with_debug_gdb"
|
||||||
@@ -4791,7 +5125,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking "for mem_tracing"""... $ac_c" 1>&6
|
echo $ac_n "checking "for mem_tracing"""... $ac_c" 1>&6
|
||||||
echo "configure:4795: checking "for mem_tracing"" >&5
|
echo "configure:5129: checking "for mem_tracing"" >&5
|
||||||
# Check whether --with-mem_tracing or --without-mem_tracing was given.
|
# Check whether --with-mem_tracing or --without-mem_tracing was given.
|
||||||
if test "${with_mem_tracing+set}" = set; then
|
if test "${with_mem_tracing+set}" = set; then
|
||||||
withval="$with_mem_tracing"
|
withval="$with_mem_tracing"
|
||||||
@@ -4821,7 +5155,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking "for dmalloc"""... $ac_c" 1>&6
|
echo $ac_n "checking "for dmalloc"""... $ac_c" 1>&6
|
||||||
echo "configure:4825: checking "for dmalloc"" >&5
|
echo "configure:5159: checking "for dmalloc"" >&5
|
||||||
# Check whether --with-dmalloc or --without-dmalloc was given.
|
# Check whether --with-dmalloc or --without-dmalloc was given.
|
||||||
if test "${with_dmalloc+set}" = set; then
|
if test "${with_dmalloc+set}" = set; then
|
||||||
withval="$with_dmalloc"
|
withval="$with_dmalloc"
|
||||||
@@ -4851,7 +5185,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking "for profile"""... $ac_c" 1>&6
|
echo $ac_n "checking "for profile"""... $ac_c" 1>&6
|
||||||
echo "configure:4855: checking "for profile"" >&5
|
echo "configure:5189: checking "for profile"" >&5
|
||||||
# Check whether --with-profile or --without-profile was given.
|
# Check whether --with-profile or --without-profile was given.
|
||||||
if test "${with_profile+set}" = set; then
|
if test "${with_profile+set}" = set; then
|
||||||
withval="$with_profile"
|
withval="$with_profile"
|
||||||
@@ -4881,7 +5215,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking "for apple_ieee"""... $ac_c" 1>&6
|
echo $ac_n "checking "for apple_ieee"""... $ac_c" 1>&6
|
||||||
echo "configure:4885: checking "for apple_ieee"" >&5
|
echo "configure:5219: checking "for apple_ieee"" >&5
|
||||||
# Check whether --with-apple_ieee or --without-apple_ieee was given.
|
# Check whether --with-apple_ieee or --without-apple_ieee was given.
|
||||||
if test "${with_apple_ieee+set}" = set; then
|
if test "${with_apple_ieee+set}" = set; then
|
||||||
withval="$with_apple_ieee"
|
withval="$with_apple_ieee"
|
||||||
@@ -4911,7 +5245,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking "for threads"""... $ac_c" 1>&6
|
echo $ac_n "checking "for threads"""... $ac_c" 1>&6
|
||||||
echo "configure:4915: checking "for threads"" >&5
|
echo "configure:5249: checking "for threads"" >&5
|
||||||
# Check whether --with-threads or --without-threads was given.
|
# Check whether --with-threads or --without-threads was given.
|
||||||
if test "${with_threads+set}" = set; then
|
if test "${with_threads+set}" = set; then
|
||||||
withval="$with_threads"
|
withval="$with_threads"
|
||||||
@@ -4942,7 +5276,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking "for zlib"""... $ac_c" 1>&6
|
echo $ac_n "checking "for zlib"""... $ac_c" 1>&6
|
||||||
echo "configure:4946: checking "for zlib"" >&5
|
echo "configure:5280: checking "for zlib"" >&5
|
||||||
# Check whether --with-zlib or --without-zlib was given.
|
# Check whether --with-zlib or --without-zlib was given.
|
||||||
if test "${with_zlib+set}" = set; then
|
if test "${with_zlib+set}" = set; then
|
||||||
withval="$with_zlib"
|
withval="$with_zlib"
|
||||||
@@ -4972,7 +5306,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking "for libpng"""... $ac_c" 1>&6
|
echo $ac_n "checking "for libpng"""... $ac_c" 1>&6
|
||||||
echo "configure:4976: checking "for libpng"" >&5
|
echo "configure:5310: checking "for libpng"" >&5
|
||||||
# Check whether --with-libpng or --without-libpng was given.
|
# Check whether --with-libpng or --without-libpng was given.
|
||||||
if test "${with_libpng+set}" = set; then
|
if test "${with_libpng+set}" = set; then
|
||||||
withval="$with_libpng"
|
withval="$with_libpng"
|
||||||
@@ -5002,7 +5336,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking "for odbc"""... $ac_c" 1>&6
|
echo $ac_n "checking "for odbc"""... $ac_c" 1>&6
|
||||||
echo "configure:5006: checking "for odbc"" >&5
|
echo "configure:5340: checking "for odbc"" >&5
|
||||||
# Check whether --with-odbc or --without-odbc was given.
|
# Check whether --with-odbc or --without-odbc was given.
|
||||||
if test "${with_odbc+set}" = set; then
|
if test "${with_odbc+set}" = set; then
|
||||||
withval="$with_odbc"
|
withval="$with_odbc"
|
||||||
@@ -5033,7 +5367,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking "for timedate"""... $ac_c" 1>&6
|
echo $ac_n "checking "for timedate"""... $ac_c" 1>&6
|
||||||
echo "configure:5037: checking "for timedate"" >&5
|
echo "configure:5371: checking "for timedate"" >&5
|
||||||
# Check whether --with-timedate or --without-timedate was given.
|
# Check whether --with-timedate or --without-timedate was given.
|
||||||
if test "${with_timedate+set}" = set; then
|
if test "${with_timedate+set}" = set; then
|
||||||
withval="$with_timedate"
|
withval="$with_timedate"
|
||||||
@@ -5063,7 +5397,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking "for intl"""... $ac_c" 1>&6
|
echo $ac_n "checking "for intl"""... $ac_c" 1>&6
|
||||||
echo "configure:5067: checking "for intl"" >&5
|
echo "configure:5401: checking "for intl"" >&5
|
||||||
# Check whether --with-intl or --without-intl was given.
|
# Check whether --with-intl or --without-intl was given.
|
||||||
if test "${with_intl+set}" = set; then
|
if test "${with_intl+set}" = set; then
|
||||||
withval="$with_intl"
|
withval="$with_intl"
|
||||||
@@ -5093,7 +5427,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking "for config"""... $ac_c" 1>&6
|
echo $ac_n "checking "for config"""... $ac_c" 1>&6
|
||||||
echo "configure:5097: checking "for config"" >&5
|
echo "configure:5431: checking "for config"" >&5
|
||||||
# Check whether --with-config or --without-config was given.
|
# Check whether --with-config or --without-config was given.
|
||||||
if test "${with_config+set}" = set; then
|
if test "${with_config+set}" = set; then
|
||||||
withval="$with_config"
|
withval="$with_config"
|
||||||
@@ -5123,7 +5457,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking "for streams"""... $ac_c" 1>&6
|
echo $ac_n "checking "for streams"""... $ac_c" 1>&6
|
||||||
echo "configure:5127: checking "for streams"" >&5
|
echo "configure:5461: checking "for streams"" >&5
|
||||||
# Check whether --with-streams or --without-streams was given.
|
# Check whether --with-streams or --without-streams was given.
|
||||||
if test "${with_streams+set}" = set; then
|
if test "${with_streams+set}" = set; then
|
||||||
withval="$with_streams"
|
withval="$with_streams"
|
||||||
@@ -5153,7 +5487,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking "for serial"""... $ac_c" 1>&6
|
echo $ac_n "checking "for serial"""... $ac_c" 1>&6
|
||||||
echo "configure:5157: checking "for serial"" >&5
|
echo "configure:5491: checking "for serial"" >&5
|
||||||
# Check whether --with-serial or --without-serial was given.
|
# Check whether --with-serial or --without-serial was given.
|
||||||
if test "${with_serial+set}" = set; then
|
if test "${with_serial+set}" = set; then
|
||||||
withval="$with_serial"
|
withval="$with_serial"
|
||||||
@@ -5184,7 +5518,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking "for afmfonts"""... $ac_c" 1>&6
|
echo $ac_n "checking "for afmfonts"""... $ac_c" 1>&6
|
||||||
echo "configure:5188: checking "for afmfonts"" >&5
|
echo "configure:5522: checking "for afmfonts"" >&5
|
||||||
# Check whether --with-afmfonts or --without-afmfonts was given.
|
# Check whether --with-afmfonts or --without-afmfonts was given.
|
||||||
if test "${with_afmfonts+set}" = set; then
|
if test "${with_afmfonts+set}" = set; then
|
||||||
withval="$with_afmfonts"
|
withval="$with_afmfonts"
|
||||||
@@ -5214,7 +5548,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking "for normalized"""... $ac_c" 1>&6
|
echo $ac_n "checking "for normalized"""... $ac_c" 1>&6
|
||||||
echo "configure:5218: checking "for normalized"" >&5
|
echo "configure:5552: checking "for normalized"" >&5
|
||||||
# Check whether --with-normalized or --without-normalized was given.
|
# Check whether --with-normalized or --without-normalized was given.
|
||||||
if test "${with_normalized+set}" = set; then
|
if test "${with_normalized+set}" = set; then
|
||||||
withval="$with_normalized"
|
withval="$with_normalized"
|
||||||
@@ -5244,7 +5578,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking "for postscript"""... $ac_c" 1>&6
|
echo $ac_n "checking "for postscript"""... $ac_c" 1>&6
|
||||||
echo "configure:5248: checking "for postscript"" >&5
|
echo "configure:5582: checking "for postscript"" >&5
|
||||||
# Check whether --with-postscript or --without-postscript was given.
|
# Check whether --with-postscript or --without-postscript was given.
|
||||||
if test "${with_postscript+set}" = set; then
|
if test "${with_postscript+set}" = set; then
|
||||||
withval="$with_postscript"
|
withval="$with_postscript"
|
||||||
@@ -5275,7 +5609,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking "for unicode"""... $ac_c" 1>&6
|
echo $ac_n "checking "for unicode"""... $ac_c" 1>&6
|
||||||
echo "configure:5279: checking "for unicode"" >&5
|
echo "configure:5613: checking "for unicode"" >&5
|
||||||
# Check whether --with-unicode or --without-unicode was given.
|
# Check whether --with-unicode or --without-unicode was given.
|
||||||
if test "${with_unicode+set}" = set; then
|
if test "${with_unicode+set}" = set; then
|
||||||
withval="$with_unicode"
|
withval="$with_unicode"
|
||||||
@@ -5305,7 +5639,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking "for wcsrtombs"""... $ac_c" 1>&6
|
echo $ac_n "checking "for wcsrtombs"""... $ac_c" 1>&6
|
||||||
echo "configure:5309: checking "for wcsrtombs"" >&5
|
echo "configure:5643: checking "for wcsrtombs"" >&5
|
||||||
# Check whether --with-wcsrtombs or --without-wcsrtombs was given.
|
# Check whether --with-wcsrtombs or --without-wcsrtombs was given.
|
||||||
if test "${with_wcsrtombs+set}" = set; then
|
if test "${with_wcsrtombs+set}" = set; then
|
||||||
withval="$with_wcsrtombs"
|
withval="$with_wcsrtombs"
|
||||||
@@ -5336,7 +5670,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking "for wxresources"""... $ac_c" 1>&6
|
echo $ac_n "checking "for wxresources"""... $ac_c" 1>&6
|
||||||
echo "configure:5340: checking "for wxresources"" >&5
|
echo "configure:5674: checking "for wxresources"" >&5
|
||||||
# Check whether --with-wxresources or --without-wxresources was given.
|
# Check whether --with-wxresources or --without-wxresources was given.
|
||||||
if test "${with_wxresources+set}" = set; then
|
if test "${with_wxresources+set}" = set; then
|
||||||
withval="$with_wxresources"
|
withval="$with_wxresources"
|
||||||
@@ -5366,7 +5700,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking "for prologio"""... $ac_c" 1>&6
|
echo $ac_n "checking "for prologio"""... $ac_c" 1>&6
|
||||||
echo "configure:5370: checking "for prologio"" >&5
|
echo "configure:5704: checking "for prologio"" >&5
|
||||||
# Check whether --with-prologio or --without-prologio was given.
|
# Check whether --with-prologio or --without-prologio was given.
|
||||||
if test "${with_prologio+set}" = set; then
|
if test "${with_prologio+set}" = set; then
|
||||||
withval="$with_prologio"
|
withval="$with_prologio"
|
||||||
@@ -5396,7 +5730,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking "for RPC"""... $ac_c" 1>&6
|
echo $ac_n "checking "for RPC"""... $ac_c" 1>&6
|
||||||
echo "configure:5400: checking "for RPC"" >&5
|
echo "configure:5734: checking "for RPC"" >&5
|
||||||
# Check whether --with-rpc or --without-rpc was given.
|
# Check whether --with-rpc or --without-rpc was given.
|
||||||
if test "${with_rpc+set}" = set; then
|
if test "${with_rpc+set}" = set; then
|
||||||
withval="$with_rpc"
|
withval="$with_rpc"
|
||||||
@@ -5427,7 +5761,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking "for IPC"""... $ac_c" 1>&6
|
echo $ac_n "checking "for IPC"""... $ac_c" 1>&6
|
||||||
echo "configure:5431: checking "for IPC"" >&5
|
echo "configure:5765: checking "for IPC"" >&5
|
||||||
# Check whether --with-ipc or --without-ipc was given.
|
# Check whether --with-ipc or --without-ipc was given.
|
||||||
if test "${with_ipc+set}" = set; then
|
if test "${with_ipc+set}" = set; then
|
||||||
withval="$with_ipc"
|
withval="$with_ipc"
|
||||||
@@ -5457,7 +5791,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking "for resources"""... $ac_c" 1>&6
|
echo $ac_n "checking "for resources"""... $ac_c" 1>&6
|
||||||
echo "configure:5461: checking "for resources"" >&5
|
echo "configure:5795: checking "for resources"" >&5
|
||||||
# Check whether --with-resources or --without-resources was given.
|
# Check whether --with-resources or --without-resources was given.
|
||||||
if test "${with_resources+set}" = set; then
|
if test "${with_resources+set}" = set; then
|
||||||
withval="$with_resources"
|
withval="$with_resources"
|
||||||
@@ -5487,7 +5821,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking "for clipboard"""... $ac_c" 1>&6
|
echo $ac_n "checking "for clipboard"""... $ac_c" 1>&6
|
||||||
echo "configure:5491: checking "for clipboard"" >&5
|
echo "configure:5825: checking "for clipboard"" >&5
|
||||||
# Check whether --with-clipboard or --without-clipboard was given.
|
# Check whether --with-clipboard or --without-clipboard was given.
|
||||||
if test "${with_clipboard+set}" = set; then
|
if test "${with_clipboard+set}" = set; then
|
||||||
withval="$with_clipboard"
|
withval="$with_clipboard"
|
||||||
@@ -5517,7 +5851,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking "for dnd"""... $ac_c" 1>&6
|
echo $ac_n "checking "for dnd"""... $ac_c" 1>&6
|
||||||
echo "configure:5521: checking "for dnd"" >&5
|
echo "configure:5855: checking "for dnd"" >&5
|
||||||
# Check whether --with-dnd or --without-dnd was given.
|
# Check whether --with-dnd or --without-dnd was given.
|
||||||
if test "${with_dnd+set}" = set; then
|
if test "${with_dnd+set}" = set; then
|
||||||
withval="$with_dnd"
|
withval="$with_dnd"
|
||||||
@@ -5548,7 +5882,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking "for mdi"""... $ac_c" 1>&6
|
echo $ac_n "checking "for mdi"""... $ac_c" 1>&6
|
||||||
echo "configure:5552: checking "for mdi"" >&5
|
echo "configure:5886: checking "for mdi"" >&5
|
||||||
# Check whether --with-mdi or --without-mdi was given.
|
# Check whether --with-mdi or --without-mdi was given.
|
||||||
if test "${with_mdi+set}" = set; then
|
if test "${with_mdi+set}" = set; then
|
||||||
withval="$with_mdi"
|
withval="$with_mdi"
|
||||||
@@ -5578,7 +5912,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking "for docview"""... $ac_c" 1>&6
|
echo $ac_n "checking "for docview"""... $ac_c" 1>&6
|
||||||
echo "configure:5582: checking "for docview"" >&5
|
echo "configure:5916: checking "for docview"" >&5
|
||||||
# Check whether --with-docview or --without-docview was given.
|
# Check whether --with-docview or --without-docview was given.
|
||||||
if test "${with_docview+set}" = set; then
|
if test "${with_docview+set}" = set; then
|
||||||
withval="$with_docview"
|
withval="$with_docview"
|
||||||
@@ -5608,7 +5942,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking "for printarch"""... $ac_c" 1>&6
|
echo $ac_n "checking "for printarch"""... $ac_c" 1>&6
|
||||||
echo "configure:5612: checking "for printarch"" >&5
|
echo "configure:5946: checking "for printarch"" >&5
|
||||||
# Check whether --with-printarch or --without-printarch was given.
|
# Check whether --with-printarch or --without-printarch was given.
|
||||||
if test "${with_printarch+set}" = set; then
|
if test "${with_printarch+set}" = set; then
|
||||||
withval="$with_printarch"
|
withval="$with_printarch"
|
||||||
@@ -5638,7 +5972,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking "for help"""... $ac_c" 1>&6
|
echo $ac_n "checking "for help"""... $ac_c" 1>&6
|
||||||
echo "configure:5642: checking "for help"" >&5
|
echo "configure:5976: checking "for help"" >&5
|
||||||
# Check whether --with-help or --without-help was given.
|
# Check whether --with-help or --without-help was given.
|
||||||
if test "${with_help+set}" = set; then
|
if test "${with_help+set}" = set; then
|
||||||
withval="$with_help"
|
withval="$with_help"
|
||||||
@@ -5676,7 +6010,7 @@ fi
|
|||||||
|
|
||||||
if test "$USE_LINUX" = 1; then
|
if test "$USE_LINUX" = 1; then
|
||||||
echo $ac_n "checking for gettext in -lc""... $ac_c" 1>&6
|
echo $ac_n "checking for gettext in -lc""... $ac_c" 1>&6
|
||||||
echo "configure:5680: checking for gettext in -lc" >&5
|
echo "configure:6014: checking for gettext in -lc" >&5
|
||||||
ac_lib_var=`echo c'_'gettext | sed 'y%./+-%__p_%'`
|
ac_lib_var=`echo c'_'gettext | sed 'y%./+-%__p_%'`
|
||||||
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
@@ -5684,7 +6018,7 @@ else
|
|||||||
ac_save_LIBS="$LIBS"
|
ac_save_LIBS="$LIBS"
|
||||||
LIBS="-lc $LIBS"
|
LIBS="-lc $LIBS"
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 5688 "configure"
|
#line 6022 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
/* Override any gcc2 internal prototype to avoid an error. */
|
/* Override any gcc2 internal prototype to avoid an error. */
|
||||||
/* We use char because int might match the return type of a gcc2
|
/* We use char because int might match the return type of a gcc2
|
||||||
@@ -5695,7 +6029,7 @@ int main() {
|
|||||||
gettext()
|
gettext()
|
||||||
; return 0; }
|
; return 0; }
|
||||||
EOF
|
EOF
|
||||||
if { (eval echo configure:5699: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
if { (eval echo configure:6033: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
eval "ac_cv_lib_$ac_lib_var=yes"
|
eval "ac_cv_lib_$ac_lib_var=yes"
|
||||||
else
|
else
|
||||||
@@ -5766,7 +6100,7 @@ fi
|
|||||||
# Extract the first word of "gtk-config", so it can be a program name with args.
|
# Extract the first word of "gtk-config", so it can be a program name with args.
|
||||||
set dummy gtk-config; ac_word=$2
|
set dummy gtk-config; ac_word=$2
|
||||||
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
|
||||||
echo "configure:5770: checking for $ac_word" >&5
|
echo "configure:6104: checking for $ac_word" >&5
|
||||||
if eval "test \"`echo '$''{'ac_cv_path_GTK_CONFIG'+set}'`\" = set"; then
|
if eval "test \"`echo '$''{'ac_cv_path_GTK_CONFIG'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
else
|
else
|
||||||
@@ -5797,7 +6131,7 @@ fi
|
|||||||
|
|
||||||
min_gtk_version=1.0.4
|
min_gtk_version=1.0.4
|
||||||
echo $ac_n "checking for GTK - version >= $min_gtk_version""... $ac_c" 1>&6
|
echo $ac_n "checking for GTK - version >= $min_gtk_version""... $ac_c" 1>&6
|
||||||
echo "configure:5801: checking for GTK - version >= $min_gtk_version" >&5
|
echo "configure:6135: checking for GTK - version >= $min_gtk_version" >&5
|
||||||
no_gtk=""
|
no_gtk=""
|
||||||
if test "$GTK_CONFIG" != "no" ; then
|
if test "$GTK_CONFIG" != "no" ; then
|
||||||
GTK_CFLAGS=`$GTK_CONFIG --cflags`
|
GTK_CFLAGS=`$GTK_CONFIG --cflags`
|
||||||
@@ -5810,7 +6144,7 @@ echo "configure:5801: checking for GTK - version >= $min_gtk_version" >&5
|
|||||||
echo $ac_n "cross compiling; assumed OK... $ac_c"
|
echo $ac_n "cross compiling; assumed OK... $ac_c"
|
||||||
else
|
else
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 5814 "configure"
|
#line 6148 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
@@ -5834,7 +6168,7 @@ main ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
if { (eval echo configure:5838: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
|
if { (eval echo configure:6172: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
|
||||||
then
|
then
|
||||||
:
|
:
|
||||||
else
|
else
|
||||||
@@ -5874,7 +6208,7 @@ fi
|
|||||||
|
|
||||||
if test "$wxUSE_QT" = 1; then
|
if test "$wxUSE_QT" = 1; then
|
||||||
echo $ac_n "checking for Qt includes""... $ac_c" 1>&6
|
echo $ac_n "checking for Qt includes""... $ac_c" 1>&6
|
||||||
echo "configure:5878: checking for Qt includes" >&5
|
echo "configure:6212: checking for Qt includes" >&5
|
||||||
|
|
||||||
ac_find_includes=
|
ac_find_includes=
|
||||||
for ac_dir in $SEARCH_INCLUDE;
|
for ac_dir in $SEARCH_INCLUDE;
|
||||||
@@ -5888,7 +6222,7 @@ for ac_dir in $SEARCH_INCLUDE;
|
|||||||
if test "$ac_find_includes" != "" ; then
|
if test "$ac_find_includes" != "" ; then
|
||||||
echo "$ac_t""found $ac_find_includes" 1>&6
|
echo "$ac_t""found $ac_find_includes" 1>&6
|
||||||
echo $ac_n "checking for Qt library""... $ac_c" 1>&6
|
echo $ac_n "checking for Qt library""... $ac_c" 1>&6
|
||||||
echo "configure:5892: checking for Qt library" >&5
|
echo "configure:6226: checking for Qt library" >&5
|
||||||
|
|
||||||
ac_find_libraries=
|
ac_find_libraries=
|
||||||
for ac_dir in $SEARCH_LIB;
|
for ac_dir in $SEARCH_LIB;
|
||||||
@@ -5939,7 +6273,7 @@ fi
|
|||||||
|
|
||||||
if test "$wxUSE_MOTIF" = 1; then
|
if test "$wxUSE_MOTIF" = 1; then
|
||||||
echo $ac_n "checking for Motif/Lesstif includes""... $ac_c" 1>&6
|
echo $ac_n "checking for Motif/Lesstif includes""... $ac_c" 1>&6
|
||||||
echo "configure:5943: checking for Motif/Lesstif includes" >&5
|
echo "configure:6277: checking for Motif/Lesstif includes" >&5
|
||||||
|
|
||||||
ac_find_includes=
|
ac_find_includes=
|
||||||
for ac_dir in $SEARCH_INCLUDE;
|
for ac_dir in $SEARCH_INCLUDE;
|
||||||
@@ -5953,7 +6287,7 @@ for ac_dir in $SEARCH_INCLUDE;
|
|||||||
if test "$ac_find_includes" != "" ; then
|
if test "$ac_find_includes" != "" ; then
|
||||||
echo "$ac_t""found $ac_find_includes" 1>&6
|
echo "$ac_t""found $ac_find_includes" 1>&6
|
||||||
echo $ac_n "checking for Motif/Lesstif library""... $ac_c" 1>&6
|
echo $ac_n "checking for Motif/Lesstif library""... $ac_c" 1>&6
|
||||||
echo "configure:5957: checking for Motif/Lesstif library" >&5
|
echo "configure:6291: checking for Motif/Lesstif library" >&5
|
||||||
|
|
||||||
ac_find_libraries=
|
ac_find_libraries=
|
||||||
for ac_dir in $SEARCH_LIB;
|
for ac_dir in $SEARCH_LIB;
|
||||||
@@ -5990,7 +6324,7 @@ for ac_dir in $SEARCH_LIB;
|
|||||||
CHECK_INCLUDE="$CHECK_INCLUDE $ac_path_to_include"
|
CHECK_INCLUDE="$CHECK_INCLUDE $ac_path_to_include"
|
||||||
echo "$ac_t""found at $ac_find_libraries" 1>&6
|
echo "$ac_t""found at $ac_find_libraries" 1>&6
|
||||||
echo $ac_n "checking for Xt library""... $ac_c" 1>&6
|
echo $ac_n "checking for Xt library""... $ac_c" 1>&6
|
||||||
echo "configure:5994: checking for Xt library" >&5
|
echo "configure:6328: checking for Xt library" >&5
|
||||||
|
|
||||||
ac_find_libraries=
|
ac_find_libraries=
|
||||||
for ac_dir in $SEARCH_LIB;
|
for ac_dir in $SEARCH_LIB;
|
||||||
@@ -6016,7 +6350,7 @@ for ac_dir in $SEARCH_LIB;
|
|||||||
CHECK_LINK="$CHECK_LIB $ac_path_to_link"
|
CHECK_LINK="$CHECK_LIB $ac_path_to_link"
|
||||||
echo "$ac_t""found at $ac_find_libraries" 1>&6
|
echo "$ac_t""found at $ac_find_libraries" 1>&6
|
||||||
echo $ac_n "checking for Xpm library""... $ac_c" 1>&6
|
echo $ac_n "checking for Xpm library""... $ac_c" 1>&6
|
||||||
echo "configure:6020: checking for Xpm library" >&5
|
echo "configure:6354: checking for Xpm library" >&5
|
||||||
|
|
||||||
ac_find_libraries=
|
ac_find_libraries=
|
||||||
for ac_dir in $SEARCH_LIB;
|
for ac_dir in $SEARCH_LIB;
|
||||||
@@ -6345,46 +6679,6 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking for main in -ldl""... $ac_c" 1>&6
|
|
||||||
echo "configure:6350: 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
|
|
||||||
else
|
|
||||||
ac_save_LIBS="$LIBS"
|
|
||||||
LIBS="-ldl $LIBS"
|
|
||||||
cat > conftest.$ac_ext <<EOF
|
|
||||||
#line 6358 "configure"
|
|
||||||
#include "confdefs.h"
|
|
||||||
|
|
||||||
int main() {
|
|
||||||
main()
|
|
||||||
; return 0; }
|
|
||||||
EOF
|
|
||||||
if { (eval echo configure:6365: \"$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
|
|
||||||
echo "configure: failed program was:" >&5
|
|
||||||
cat conftest.$ac_ext >&5
|
|
||||||
rm -rf conftest*
|
|
||||||
eval "ac_cv_lib_$ac_lib_var=no"
|
|
||||||
fi
|
|
||||||
rm -f conftest*
|
|
||||||
LIBS="$ac_save_LIBS"
|
|
||||||
|
|
||||||
fi
|
|
||||||
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
|
|
||||||
echo "$ac_t""yes" 1>&6
|
|
||||||
DL_LIBRARY=-ldl
|
|
||||||
else
|
|
||||||
echo "$ac_t""no" 1>&6
|
|
||||||
DL_LIBRARY=
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
THREADS_LINK=""
|
THREADS_LINK=""
|
||||||
UNIX_THREAD=""
|
UNIX_THREAD=""
|
||||||
|
|
||||||
@@ -6392,7 +6686,7 @@ if test "$wxUSE_THREADS" = "1"; then
|
|||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking for pthread_create in -lpthread-0.7""... $ac_c" 1>&6
|
echo $ac_n "checking for pthread_create in -lpthread-0.7""... $ac_c" 1>&6
|
||||||
echo "configure:6396: checking for pthread_create in -lpthread-0.7" >&5
|
echo "configure:6690: checking for pthread_create in -lpthread-0.7" >&5
|
||||||
ac_lib_var=`echo pthread-0.7'_'pthread_create | sed 'y%./+-%__p_%'`
|
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
|
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
@@ -6400,7 +6694,7 @@ else
|
|||||||
ac_save_LIBS="$LIBS"
|
ac_save_LIBS="$LIBS"
|
||||||
LIBS="-lpthread-0.7 $LIBS"
|
LIBS="-lpthread-0.7 $LIBS"
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 6404 "configure"
|
#line 6698 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
/* Override any gcc2 internal prototype to avoid an error. */
|
/* Override any gcc2 internal prototype to avoid an error. */
|
||||||
/* We use char because int might match the return type of a gcc2
|
/* We use char because int might match the return type of a gcc2
|
||||||
@@ -6411,7 +6705,7 @@ int main() {
|
|||||||
pthread_create()
|
pthread_create()
|
||||||
; return 0; }
|
; return 0; }
|
||||||
EOF
|
EOF
|
||||||
if { (eval echo configure:6415: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
if { (eval echo configure:6709: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
eval "ac_cv_lib_$ac_lib_var=yes"
|
eval "ac_cv_lib_$ac_lib_var=yes"
|
||||||
else
|
else
|
||||||
@@ -6435,17 +6729,17 @@ else
|
|||||||
|
|
||||||
ac_safe=`echo "sys/prctl.h" | sed 'y%./+-%__p_%'`
|
ac_safe=`echo "sys/prctl.h" | sed 'y%./+-%__p_%'`
|
||||||
echo $ac_n "checking for sys/prctl.h""... $ac_c" 1>&6
|
echo $ac_n "checking for sys/prctl.h""... $ac_c" 1>&6
|
||||||
echo "configure:6439: checking for sys/prctl.h" >&5
|
echo "configure:6733: checking for sys/prctl.h" >&5
|
||||||
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
|
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
else
|
else
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 6444 "configure"
|
#line 6738 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
#include <sys/prctl.h>
|
#include <sys/prctl.h>
|
||||||
EOF
|
EOF
|
||||||
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||||
{ (eval echo configure:6449: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
{ (eval echo configure:6743: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||||
ac_err=`grep -v '^ *+' conftest.out`
|
ac_err=`grep -v '^ *+' conftest.out`
|
||||||
if test -z "$ac_err"; then
|
if test -z "$ac_err"; then
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
@@ -6471,7 +6765,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking for pthread_setcanceltype in -lpthread""... $ac_c" 1>&6
|
echo $ac_n "checking for pthread_setcanceltype in -lpthread""... $ac_c" 1>&6
|
||||||
echo "configure:6475: checking for pthread_setcanceltype in -lpthread" >&5
|
echo "configure:6769: checking for pthread_setcanceltype in -lpthread" >&5
|
||||||
ac_lib_var=`echo pthread'_'pthread_setcanceltype | sed 'y%./+-%__p_%'`
|
ac_lib_var=`echo pthread'_'pthread_setcanceltype | sed 'y%./+-%__p_%'`
|
||||||
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
@@ -6479,7 +6773,7 @@ else
|
|||||||
ac_save_LIBS="$LIBS"
|
ac_save_LIBS="$LIBS"
|
||||||
LIBS="-lpthread $LIBS"
|
LIBS="-lpthread $LIBS"
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 6483 "configure"
|
#line 6777 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
/* Override any gcc2 internal prototype to avoid an error. */
|
/* Override any gcc2 internal prototype to avoid an error. */
|
||||||
/* We use char because int might match the return type of a gcc2
|
/* We use char because int might match the return type of a gcc2
|
||||||
@@ -6490,7 +6784,7 @@ int main() {
|
|||||||
pthread_setcanceltype()
|
pthread_setcanceltype()
|
||||||
; return 0; }
|
; return 0; }
|
||||||
EOF
|
EOF
|
||||||
if { (eval echo configure:6494: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
if { (eval echo configure:6788: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
eval "ac_cv_lib_$ac_lib_var=yes"
|
eval "ac_cv_lib_$ac_lib_var=yes"
|
||||||
else
|
else
|
||||||
@@ -6526,7 +6820,7 @@ EOF
|
|||||||
|
|
||||||
|
|
||||||
echo $ac_n "checking for printf in -lposix4""... $ac_c" 1>&6
|
echo $ac_n "checking for printf in -lposix4""... $ac_c" 1>&6
|
||||||
echo "configure:6530: checking for printf in -lposix4" >&5
|
echo "configure:6824: checking for printf in -lposix4" >&5
|
||||||
ac_lib_var=`echo posix4'_'printf | sed 'y%./+-%__p_%'`
|
ac_lib_var=`echo posix4'_'printf | sed 'y%./+-%__p_%'`
|
||||||
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||||
echo $ac_n "(cached) $ac_c" 1>&6
|
echo $ac_n "(cached) $ac_c" 1>&6
|
||||||
@@ -6534,7 +6828,7 @@ else
|
|||||||
ac_save_LIBS="$LIBS"
|
ac_save_LIBS="$LIBS"
|
||||||
LIBS="-lposix4 $LIBS"
|
LIBS="-lposix4 $LIBS"
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 6538 "configure"
|
#line 6832 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
/* Override any gcc2 internal prototype to avoid an error. */
|
/* Override any gcc2 internal prototype to avoid an error. */
|
||||||
/* We use char because int might match the return type of a gcc2
|
/* We use char because int might match the return type of a gcc2
|
||||||
@@ -6545,7 +6839,7 @@ int main() {
|
|||||||
printf()
|
printf()
|
||||||
; return 0; }
|
; return 0; }
|
||||||
EOF
|
EOF
|
||||||
if { (eval echo configure:6549: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
if { (eval echo configure:6843: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
||||||
rm -rf conftest*
|
rm -rf conftest*
|
||||||
eval "ac_cv_lib_$ac_lib_var=yes"
|
eval "ac_cv_lib_$ac_lib_var=yes"
|
||||||
else
|
else
|
||||||
@@ -6700,7 +6994,7 @@ EOF
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
if test "x$GCC" = xyes; then
|
if test "x$GCC" = xyes; then
|
||||||
CFLAGS="${CFLAGS} -Wall -Wno-unused -Wno-uninitialized -D_REENTRANT -DLEX_SCANNER"
|
CFLAGS="${CFLAGS} -Wall -Wno-unused -Wno-uninitialized -D_REENTRANT -DLEX_SCANNER -DHAVE_LIBDL"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "x$GXX" = xyes; then
|
if test "x$GXX" = xyes; then
|
||||||
@@ -6876,6 +7170,7 @@ s%@YACC@%$YACC%g
|
|||||||
s%@LEX@%$LEX%g
|
s%@LEX@%$LEX%g
|
||||||
s%@LEXLIB@%$LEXLIB%g
|
s%@LEXLIB@%$LEXLIB%g
|
||||||
s%@LEX_OUTPUT_ROOT@%$LEX_OUTPUT_ROOT%g
|
s%@LEX_OUTPUT_ROOT@%$LEX_OUTPUT_ROOT%g
|
||||||
|
s%@DL_LIBRARY@%$DL_LIBRARY%g
|
||||||
s%@host@%$host%g
|
s%@host@%$host%g
|
||||||
s%@host_alias@%$host_alias%g
|
s%@host_alias@%$host_alias%g
|
||||||
s%@host_cpu@%$host_cpu%g
|
s%@host_cpu@%$host_cpu%g
|
||||||
@@ -6900,7 +7195,6 @@ s%@Z_C_SRC@%$Z_C_SRC%g
|
|||||||
s%@PNG_C_SRC@%$PNG_C_SRC%g
|
s%@PNG_C_SRC@%$PNG_C_SRC%g
|
||||||
s%@IODBC_C_SRC@%$IODBC_C_SRC%g
|
s%@IODBC_C_SRC@%$IODBC_C_SRC%g
|
||||||
s%@HELP@%$HELP%g
|
s%@HELP@%$HELP%g
|
||||||
s%@DL_LIBRARY@%$DL_LIBRARY%g
|
|
||||||
s%@UNIX_THREAD@%$UNIX_THREAD%g
|
s%@UNIX_THREAD@%$UNIX_THREAD%g
|
||||||
s%@THREADS_LINK@%$THREADS_LINK%g
|
s%@THREADS_LINK@%$THREADS_LINK%g
|
||||||
s%@OS@%$OS%g
|
s%@OS@%$OS%g
|
||||||
|
|||||||
63
configure.in
63
configure.in
@@ -559,6 +559,60 @@ dnl defines YYTEXT_POINTER if yytext is char*
|
|||||||
dnl defines LEX_OUTPUT_ROOT as to the base of the
|
dnl defines LEX_OUTPUT_ROOT as to the base of the
|
||||||
dnl filename output by the lexer
|
dnl filename output by the lexer
|
||||||
|
|
||||||
|
dnl ###################################
|
||||||
|
dnl ## Check for dynamic load module #
|
||||||
|
dnl ###################################
|
||||||
|
|
||||||
|
DL_LIBRARY=
|
||||||
|
AC_CHECK_FUNCS(dlopen, AC_DEFINE(HAVE_LIBDL),
|
||||||
|
[AC_CHECK_LIB(dl, dlopen, [AC_DEFINE(HAVE_LIBDL) DL_LIBRARY="-ldl"],
|
||||||
|
[AC_CHECK_LIB(dld, dld_link, [AC_DEFINE(HAVE_DLD) DL_LIBRARY="-ldld"],
|
||||||
|
[AC_CHECK_FUNCS(shl_load, AC_DEFINE(HAVE_SHL_LOAD) )]
|
||||||
|
)]
|
||||||
|
)]
|
||||||
|
)
|
||||||
|
AC_SUBST(DL_LIBRARY)
|
||||||
|
|
||||||
|
AC_CACHE_CHECK([for underscore before symbols], libltdl_cv_uscore, [
|
||||||
|
echo "main(){int i=1;} fnord(){int i=23; int ltuae=42;}" > conftest.c
|
||||||
|
${CC} -c conftest.c > /dev/null
|
||||||
|
if (nm conftest.o | grep _fnord) > /dev/null; then
|
||||||
|
libltdl_cv_uscore=yes
|
||||||
|
else
|
||||||
|
libltdl_cv_uscore=no
|
||||||
|
fi
|
||||||
|
rm -f conftest*
|
||||||
|
])
|
||||||
|
|
||||||
|
if test x"$libltdl_cv_uscore" = xyes; then
|
||||||
|
if test x"$ac_cv_func_dlopen" = xyes ||
|
||||||
|
test x"$ac_cv_lib_dl_dlopen" = xyes ; then
|
||||||
|
AC_CACHE_CHECK([whether we have to add an underscore for dlsym],
|
||||||
|
libltdl_cv_need_uscore, [dnl
|
||||||
|
AC_TRY_RUN([
|
||||||
|
#include <dlfcn.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
fnord() { int i=42;}
|
||||||
|
main() { void *self, *ptr1, *ptr2; self=dlopen(NULL,RTLD_LAZY);
|
||||||
|
if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord");
|
||||||
|
if(ptr1 && !ptr2) exit(0); } exit(1); }
|
||||||
|
], libltdl_cv_need_uscore=no, libltdl_cv_need_uscore=yes,
|
||||||
|
libltdl_cv_need_uscore=no
|
||||||
|
)])
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test x"$libltdl_cv_need_uscore" = xyes; then
|
||||||
|
AC_DEFINE(NEED_USCORE)
|
||||||
|
fi
|
||||||
|
|
||||||
|
dnl ##########################################
|
||||||
|
dnl ## Check for specific library functions #
|
||||||
|
dnl ##########################################
|
||||||
|
|
||||||
|
dnl Checks for library functions.
|
||||||
|
AC_CHECK_FUNCS(strerror)
|
||||||
|
|
||||||
dnl ------------------------------------------------------------------------
|
dnl ------------------------------------------------------------------------
|
||||||
dnl main includes
|
dnl main includes
|
||||||
dnl ------------------------------------------------------------------------
|
dnl ------------------------------------------------------------------------
|
||||||
@@ -1243,13 +1297,6 @@ if test "$wxUSE_HELP" = 1 ; then
|
|||||||
fi
|
fi
|
||||||
AC_SUBST(HELP)
|
AC_SUBST(HELP)
|
||||||
|
|
||||||
dnl ----------------------------------------------------------------
|
|
||||||
dnl select dynamic loader (used by iODBC to load drivers)
|
|
||||||
dnl ----------------------------------------------------------------
|
|
||||||
|
|
||||||
AC_CHECK_LIB(dl,main,[DL_LIBRARY=-ldl],[DL_LIBRARY=])
|
|
||||||
AC_SUBST(DL_LIBRARY)
|
|
||||||
|
|
||||||
dnl ----------------------------------------------------------------
|
dnl ----------------------------------------------------------------
|
||||||
dnl thread support
|
dnl thread support
|
||||||
dnl ----------------------------------------------------------------
|
dnl ----------------------------------------------------------------
|
||||||
@@ -1405,7 +1452,7 @@ case "${canonical}" in
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
if test "x$GCC" = xyes; then
|
if test "x$GCC" = xyes; then
|
||||||
CFLAGS="${CFLAGS} -Wall -Wno-unused -Wno-uninitialized -D_REENTRANT -DLEX_SCANNER"
|
CFLAGS="${CFLAGS} -Wall -Wno-unused -Wno-uninitialized -D_REENTRANT -DLEX_SCANNER -DHAVE_LIBDL"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "x$GXX" = xyes; then
|
if test "x$GXX" = xyes; then
|
||||||
|
|||||||
@@ -45,11 +45,9 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#include <../iodbc/isql.h>
|
#include <../iodbc/isql.h>
|
||||||
#include <../iodbc/isqlext.h>
|
#include <../iodbc/isqlext.h>
|
||||||
#include <../iodbc/odbc_funcs.h>
|
|
||||||
#include <../iodbc/odbc_types.h>
|
|
||||||
|
|
||||||
typedef float SFLOAT;
|
typedef float SFLOAT;
|
||||||
typedef double SDOUBLE;
|
typedef double SDOUBLE;
|
||||||
|
typedef unsigned int UINT;
|
||||||
#define ULONG UDWORD
|
#define ULONG UDWORD
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,19 +63,23 @@ class wxDataFormat : public wxObject
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
wxDataFormat();
|
||||||
wxDataFormat( wxDataType type );
|
wxDataFormat( wxDataType type );
|
||||||
wxDataFormat( const wxString &id );
|
wxDataFormat( const wxString &id );
|
||||||
wxDataFormat( wxDataFormat &format );
|
wxDataFormat( wxDataFormat &format );
|
||||||
wxDataFormat( const GdkAtom atom );
|
wxDataFormat( const GdkAtom atom );
|
||||||
|
|
||||||
int GetType() const;
|
void SetType( wxDataType type );
|
||||||
|
wxDataType GetType() const;
|
||||||
|
|
||||||
wxString GetId() const;
|
wxString GetId() const;
|
||||||
void SetId( const wxString &id );
|
void SetId( const wxString &id );
|
||||||
|
|
||||||
GdkAtom GetAtom();
|
GdkAtom GetAtom();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
int m_type;
|
wxDataType m_type;
|
||||||
wxString m_id;
|
wxString m_id;
|
||||||
bool m_hasAtom;
|
bool m_hasAtom;
|
||||||
GdkAtom m_atom;
|
GdkAtom m_atom;
|
||||||
@@ -151,9 +155,13 @@ public:
|
|||||||
|
|
||||||
/* implementation */
|
/* implementation */
|
||||||
|
|
||||||
virtual wxDataFormat &GetFormat() const;
|
wxDataFormat &GetFormat();
|
||||||
|
|
||||||
wxDataFormat *m_format;
|
wxDataType GetFormatType() const;
|
||||||
|
wxString GetFormatId() const;
|
||||||
|
GdkAtom GetFormatAtom() const;
|
||||||
|
|
||||||
|
wxDataFormat m_format;
|
||||||
};
|
};
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -63,19 +63,23 @@ class wxDataFormat : public wxObject
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
wxDataFormat();
|
||||||
wxDataFormat( wxDataType type );
|
wxDataFormat( wxDataType type );
|
||||||
wxDataFormat( const wxString &id );
|
wxDataFormat( const wxString &id );
|
||||||
wxDataFormat( wxDataFormat &format );
|
wxDataFormat( wxDataFormat &format );
|
||||||
wxDataFormat( const GdkAtom atom );
|
wxDataFormat( const GdkAtom atom );
|
||||||
|
|
||||||
int GetType() const;
|
void SetType( wxDataType type );
|
||||||
|
wxDataType GetType() const;
|
||||||
|
|
||||||
wxString GetId() const;
|
wxString GetId() const;
|
||||||
void SetId( const wxString &id );
|
void SetId( const wxString &id );
|
||||||
|
|
||||||
GdkAtom GetAtom();
|
GdkAtom GetAtom();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
int m_type;
|
wxDataType m_type;
|
||||||
wxString m_id;
|
wxString m_id;
|
||||||
bool m_hasAtom;
|
bool m_hasAtom;
|
||||||
GdkAtom m_atom;
|
GdkAtom m_atom;
|
||||||
@@ -151,9 +155,13 @@ public:
|
|||||||
|
|
||||||
/* implementation */
|
/* implementation */
|
||||||
|
|
||||||
virtual wxDataFormat &GetFormat() const;
|
wxDataFormat &GetFormat();
|
||||||
|
|
||||||
wxDataFormat *m_format;
|
wxDataType GetFormatType() const;
|
||||||
|
wxString GetFormatId() const;
|
||||||
|
GdkAtom GetFormatAtom() const;
|
||||||
|
|
||||||
|
wxDataFormat m_format;
|
||||||
};
|
};
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ IODBC_C_SRC=\
|
|||||||
iodbc/hstmt.c \
|
iodbc/hstmt.c \
|
||||||
iodbc/info.c \
|
iodbc/info.c \
|
||||||
iodbc/itrace.c \
|
iodbc/itrace.c \
|
||||||
iodbc/main.c \
|
|
||||||
iodbc/misc.c \
|
iodbc/misc.c \
|
||||||
iodbc/prepare.c \
|
iodbc/prepare.c \
|
||||||
iodbc/result.c
|
iodbc/result.c
|
||||||
|
|||||||
@@ -23,37 +23,21 @@
|
|||||||
|
|
||||||
IMPLEMENT_CLASS(wxDataFormat, wxObject)
|
IMPLEMENT_CLASS(wxDataFormat, wxObject)
|
||||||
|
|
||||||
|
wxDataFormat::wxDataFormat()
|
||||||
|
{
|
||||||
|
m_type = wxDF_INVALID;
|
||||||
|
m_hasAtom = FALSE;
|
||||||
|
m_atom = (GdkAtom) 0;
|
||||||
|
}
|
||||||
|
|
||||||
wxDataFormat::wxDataFormat( wxDataType type )
|
wxDataFormat::wxDataFormat( wxDataType type )
|
||||||
{
|
{
|
||||||
m_type = type;
|
SetType( type );
|
||||||
|
|
||||||
if (m_type == wxDF_TEXT)
|
|
||||||
{
|
|
||||||
m_id = "STRING";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if (m_type == wxDF_BITMAP)
|
|
||||||
{
|
|
||||||
m_id = "BITMAP";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if (m_type == wxDF_FILENAME)
|
|
||||||
{
|
|
||||||
m_id = "file:ALL";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
wxFAIL_MSG( "invalid dataformat" );
|
|
||||||
}
|
|
||||||
|
|
||||||
m_hasAtom = FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDataFormat::wxDataFormat( const wxString &id )
|
wxDataFormat::wxDataFormat( const wxString &id )
|
||||||
{
|
{
|
||||||
m_type = wxDF_PRIVATE;
|
SetId( id );
|
||||||
m_id = id;
|
|
||||||
m_hasAtom = FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDataFormat::wxDataFormat( wxDataFormat &format )
|
wxDataFormat::wxDataFormat( wxDataFormat &format )
|
||||||
@@ -89,7 +73,33 @@ wxDataFormat::wxDataFormat( const GdkAtom atom )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxDataFormat::GetType() const
|
void wxDataFormat::SetType( wxDataType type )
|
||||||
|
{
|
||||||
|
m_type = type;
|
||||||
|
|
||||||
|
if (m_type == wxDF_TEXT)
|
||||||
|
{
|
||||||
|
m_id = "STRING";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (m_type == wxDF_BITMAP)
|
||||||
|
{
|
||||||
|
m_id = "BITMAP";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (m_type == wxDF_FILENAME)
|
||||||
|
{
|
||||||
|
m_id = "file:ALL";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxFAIL_MSG( "invalid dataformat" );
|
||||||
|
}
|
||||||
|
|
||||||
|
m_hasAtom = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxDataType wxDataFormat::GetType() const
|
||||||
{
|
{
|
||||||
return m_type;
|
return m_type;
|
||||||
}
|
}
|
||||||
@@ -246,19 +256,31 @@ IMPLEMENT_ABSTRACT_CLASS( wxDataObject, wxObject )
|
|||||||
|
|
||||||
wxDataObject::wxDataObject()
|
wxDataObject::wxDataObject()
|
||||||
{
|
{
|
||||||
m_format = (wxDataFormat*) NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDataObject::~wxDataObject()
|
wxDataObject::~wxDataObject()
|
||||||
{
|
{
|
||||||
if (m_format) delete m_format;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDataFormat &wxDataObject::GetFormat() const
|
wxDataFormat &wxDataObject::GetFormat()
|
||||||
{
|
{
|
||||||
wxASSERT( m_format );
|
return m_format;
|
||||||
|
}
|
||||||
|
|
||||||
return (*m_format);
|
wxDataType wxDataObject::GetFormatType() const
|
||||||
|
{
|
||||||
|
return m_format.GetType();
|
||||||
|
}
|
||||||
|
|
||||||
|
wxString wxDataObject::GetFormatId() const
|
||||||
|
{
|
||||||
|
return m_format.GetId();
|
||||||
|
}
|
||||||
|
|
||||||
|
GdkAtom wxDataObject::GetFormatAtom() const
|
||||||
|
{
|
||||||
|
GdkAtom ret = m_format.GetAtom();
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -269,12 +291,12 @@ IMPLEMENT_DYNAMIC_CLASS( wxTextDataObject, wxDataObject )
|
|||||||
|
|
||||||
wxTextDataObject::wxTextDataObject()
|
wxTextDataObject::wxTextDataObject()
|
||||||
{
|
{
|
||||||
m_format = new wxDataFormat( wxDF_TEXT );
|
m_format.SetType( wxDF_TEXT );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxTextDataObject::wxTextDataObject( const wxString& data )
|
wxTextDataObject::wxTextDataObject( const wxString& data )
|
||||||
{
|
{
|
||||||
m_format = new wxDataFormat( wxDF_TEXT );
|
m_format.SetType( wxDF_TEXT );
|
||||||
|
|
||||||
m_data = data;
|
m_data = data;
|
||||||
}
|
}
|
||||||
@@ -310,9 +332,9 @@ void wxTextDataObject::WriteString( const wxString &str, void *dest ) const
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS( wxFileDataObject, wxDataObject )
|
IMPLEMENT_DYNAMIC_CLASS( wxFileDataObject, wxDataObject )
|
||||||
|
|
||||||
wxFileDataObject::wxFileDataObject(void)
|
wxFileDataObject::wxFileDataObject()
|
||||||
{
|
{
|
||||||
m_format = new wxDataFormat( wxDF_FILENAME );
|
m_format.SetType( wxDF_FILENAME );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileDataObject::AddFile( const wxString &file )
|
void wxFileDataObject::AddFile( const wxString &file )
|
||||||
@@ -344,12 +366,12 @@ IMPLEMENT_DYNAMIC_CLASS( wxBitmapDataObject, wxDataObject )
|
|||||||
|
|
||||||
wxBitmapDataObject::wxBitmapDataObject()
|
wxBitmapDataObject::wxBitmapDataObject()
|
||||||
{
|
{
|
||||||
m_format = new wxDataFormat( wxDF_BITMAP );
|
m_format.SetType( wxDF_BITMAP );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxBitmapDataObject::wxBitmapDataObject( const wxBitmap& bitmap )
|
wxBitmapDataObject::wxBitmapDataObject( const wxBitmap& bitmap )
|
||||||
{
|
{
|
||||||
m_format = new wxDataFormat( wxDF_BITMAP );
|
m_format.SetType( wxDF_BITMAP );
|
||||||
|
|
||||||
m_bitmap = bitmap;
|
m_bitmap = bitmap;
|
||||||
}
|
}
|
||||||
@@ -390,7 +412,7 @@ wxPrivateDataObject::wxPrivateDataObject()
|
|||||||
m_id = "application/";
|
m_id = "application/";
|
||||||
m_id += wxTheApp->GetAppName();
|
m_id += wxTheApp->GetAppName();
|
||||||
|
|
||||||
m_format = new wxDataFormat( m_id );
|
m_format.SetId( m_id );
|
||||||
|
|
||||||
m_size = 0;
|
m_size = 0;
|
||||||
m_data = (char*) NULL;
|
m_data = (char*) NULL;
|
||||||
@@ -404,7 +426,7 @@ wxPrivateDataObject::~wxPrivateDataObject()
|
|||||||
void wxPrivateDataObject::SetId( const wxString& id )
|
void wxPrivateDataObject::SetId( const wxString& id )
|
||||||
{
|
{
|
||||||
m_id = id;
|
m_id = id;
|
||||||
m_format->SetId( m_id );
|
m_format.SetId( m_id );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxPrivateDataObject::GetId() const
|
wxString wxPrivateDataObject::GetId() const
|
||||||
|
|||||||
@@ -23,37 +23,21 @@
|
|||||||
|
|
||||||
IMPLEMENT_CLASS(wxDataFormat, wxObject)
|
IMPLEMENT_CLASS(wxDataFormat, wxObject)
|
||||||
|
|
||||||
|
wxDataFormat::wxDataFormat()
|
||||||
|
{
|
||||||
|
m_type = wxDF_INVALID;
|
||||||
|
m_hasAtom = FALSE;
|
||||||
|
m_atom = (GdkAtom) 0;
|
||||||
|
}
|
||||||
|
|
||||||
wxDataFormat::wxDataFormat( wxDataType type )
|
wxDataFormat::wxDataFormat( wxDataType type )
|
||||||
{
|
{
|
||||||
m_type = type;
|
SetType( type );
|
||||||
|
|
||||||
if (m_type == wxDF_TEXT)
|
|
||||||
{
|
|
||||||
m_id = "STRING";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if (m_type == wxDF_BITMAP)
|
|
||||||
{
|
|
||||||
m_id = "BITMAP";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if (m_type == wxDF_FILENAME)
|
|
||||||
{
|
|
||||||
m_id = "file:ALL";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
wxFAIL_MSG( "invalid dataformat" );
|
|
||||||
}
|
|
||||||
|
|
||||||
m_hasAtom = FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDataFormat::wxDataFormat( const wxString &id )
|
wxDataFormat::wxDataFormat( const wxString &id )
|
||||||
{
|
{
|
||||||
m_type = wxDF_PRIVATE;
|
SetId( id );
|
||||||
m_id = id;
|
|
||||||
m_hasAtom = FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDataFormat::wxDataFormat( wxDataFormat &format )
|
wxDataFormat::wxDataFormat( wxDataFormat &format )
|
||||||
@@ -89,7 +73,33 @@ wxDataFormat::wxDataFormat( const GdkAtom atom )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxDataFormat::GetType() const
|
void wxDataFormat::SetType( wxDataType type )
|
||||||
|
{
|
||||||
|
m_type = type;
|
||||||
|
|
||||||
|
if (m_type == wxDF_TEXT)
|
||||||
|
{
|
||||||
|
m_id = "STRING";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (m_type == wxDF_BITMAP)
|
||||||
|
{
|
||||||
|
m_id = "BITMAP";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (m_type == wxDF_FILENAME)
|
||||||
|
{
|
||||||
|
m_id = "file:ALL";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxFAIL_MSG( "invalid dataformat" );
|
||||||
|
}
|
||||||
|
|
||||||
|
m_hasAtom = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxDataType wxDataFormat::GetType() const
|
||||||
{
|
{
|
||||||
return m_type;
|
return m_type;
|
||||||
}
|
}
|
||||||
@@ -246,19 +256,31 @@ IMPLEMENT_ABSTRACT_CLASS( wxDataObject, wxObject )
|
|||||||
|
|
||||||
wxDataObject::wxDataObject()
|
wxDataObject::wxDataObject()
|
||||||
{
|
{
|
||||||
m_format = (wxDataFormat*) NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDataObject::~wxDataObject()
|
wxDataObject::~wxDataObject()
|
||||||
{
|
{
|
||||||
if (m_format) delete m_format;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDataFormat &wxDataObject::GetFormat() const
|
wxDataFormat &wxDataObject::GetFormat()
|
||||||
{
|
{
|
||||||
wxASSERT( m_format );
|
return m_format;
|
||||||
|
}
|
||||||
|
|
||||||
return (*m_format);
|
wxDataType wxDataObject::GetFormatType() const
|
||||||
|
{
|
||||||
|
return m_format.GetType();
|
||||||
|
}
|
||||||
|
|
||||||
|
wxString wxDataObject::GetFormatId() const
|
||||||
|
{
|
||||||
|
return m_format.GetId();
|
||||||
|
}
|
||||||
|
|
||||||
|
GdkAtom wxDataObject::GetFormatAtom() const
|
||||||
|
{
|
||||||
|
GdkAtom ret = m_format.GetAtom();
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -269,12 +291,12 @@ IMPLEMENT_DYNAMIC_CLASS( wxTextDataObject, wxDataObject )
|
|||||||
|
|
||||||
wxTextDataObject::wxTextDataObject()
|
wxTextDataObject::wxTextDataObject()
|
||||||
{
|
{
|
||||||
m_format = new wxDataFormat( wxDF_TEXT );
|
m_format.SetType( wxDF_TEXT );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxTextDataObject::wxTextDataObject( const wxString& data )
|
wxTextDataObject::wxTextDataObject( const wxString& data )
|
||||||
{
|
{
|
||||||
m_format = new wxDataFormat( wxDF_TEXT );
|
m_format.SetType( wxDF_TEXT );
|
||||||
|
|
||||||
m_data = data;
|
m_data = data;
|
||||||
}
|
}
|
||||||
@@ -310,9 +332,9 @@ void wxTextDataObject::WriteString( const wxString &str, void *dest ) const
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS( wxFileDataObject, wxDataObject )
|
IMPLEMENT_DYNAMIC_CLASS( wxFileDataObject, wxDataObject )
|
||||||
|
|
||||||
wxFileDataObject::wxFileDataObject(void)
|
wxFileDataObject::wxFileDataObject()
|
||||||
{
|
{
|
||||||
m_format = new wxDataFormat( wxDF_FILENAME );
|
m_format.SetType( wxDF_FILENAME );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFileDataObject::AddFile( const wxString &file )
|
void wxFileDataObject::AddFile( const wxString &file )
|
||||||
@@ -344,12 +366,12 @@ IMPLEMENT_DYNAMIC_CLASS( wxBitmapDataObject, wxDataObject )
|
|||||||
|
|
||||||
wxBitmapDataObject::wxBitmapDataObject()
|
wxBitmapDataObject::wxBitmapDataObject()
|
||||||
{
|
{
|
||||||
m_format = new wxDataFormat( wxDF_BITMAP );
|
m_format.SetType( wxDF_BITMAP );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxBitmapDataObject::wxBitmapDataObject( const wxBitmap& bitmap )
|
wxBitmapDataObject::wxBitmapDataObject( const wxBitmap& bitmap )
|
||||||
{
|
{
|
||||||
m_format = new wxDataFormat( wxDF_BITMAP );
|
m_format.SetType( wxDF_BITMAP );
|
||||||
|
|
||||||
m_bitmap = bitmap;
|
m_bitmap = bitmap;
|
||||||
}
|
}
|
||||||
@@ -390,7 +412,7 @@ wxPrivateDataObject::wxPrivateDataObject()
|
|||||||
m_id = "application/";
|
m_id = "application/";
|
||||||
m_id += wxTheApp->GetAppName();
|
m_id += wxTheApp->GetAppName();
|
||||||
|
|
||||||
m_format = new wxDataFormat( m_id );
|
m_format.SetId( m_id );
|
||||||
|
|
||||||
m_size = 0;
|
m_size = 0;
|
||||||
m_data = (char*) NULL;
|
m_data = (char*) NULL;
|
||||||
@@ -404,7 +426,7 @@ wxPrivateDataObject::~wxPrivateDataObject()
|
|||||||
void wxPrivateDataObject::SetId( const wxString& id )
|
void wxPrivateDataObject::SetId( const wxString& id )
|
||||||
{
|
{
|
||||||
m_id = id;
|
m_id = id;
|
||||||
m_format->SetId( m_id );
|
m_format.SetId( m_id );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxPrivateDataObject::GetId() const
|
wxString wxPrivateDataObject::GetId() const
|
||||||
|
|||||||
482
src/iodbc/COPYING
Normal file
482
src/iodbc/COPYING
Normal file
@@ -0,0 +1,482 @@
|
|||||||
|
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||||
|
Version 2, June 1991
|
||||||
|
|
||||||
|
Copyright (C) 1991 Free Software Foundation, Inc.
|
||||||
|
675 Mass Ave, Cambridge, MA 02139, USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
[This is the first released version of the library GPL. It is
|
||||||
|
numbered 2 because it goes with version 2 of the ordinary GPL.]
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
Licenses are intended to guarantee your freedom to share and change
|
||||||
|
free software--to make sure the software is free for all its users.
|
||||||
|
|
||||||
|
This license, the Library General Public License, applies to some
|
||||||
|
specially designated Free Software Foundation software, and to any
|
||||||
|
other libraries whose authors decide to use it. You can use it for
|
||||||
|
your libraries, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
this service if you wish), that you receive source code or can get it
|
||||||
|
if you want it, that you can change the software or use pieces of it
|
||||||
|
in new free programs; and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
anyone to deny you these rights or to ask you to surrender the rights.
|
||||||
|
These restrictions translate to certain responsibilities for you if
|
||||||
|
you distribute copies of the library, or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of the library, whether gratis
|
||||||
|
or for a fee, you must give the recipients all the rights that we gave
|
||||||
|
you. You must make sure that they, too, receive or can get the source
|
||||||
|
code. If you link a program with the library, you must provide
|
||||||
|
complete object files to the recipients so that they can relink them
|
||||||
|
with the library, after making changes to the library and recompiling
|
||||||
|
it. And you must show them these terms so they know their rights.
|
||||||
|
|
||||||
|
Our method of protecting your rights has two steps: (1) copyright
|
||||||
|
the library, and (2) offer you this license which gives you legal
|
||||||
|
permission to copy, distribute and/or modify the library.
|
||||||
|
|
||||||
|
Also, for each distributor's protection, we want to make certain
|
||||||
|
that everyone understands that there is no warranty for this free
|
||||||
|
library. If the library is modified by someone else and passed on, we
|
||||||
|
want its recipients to know that what they have is not the original
|
||||||
|
version, so that any problems introduced by others will not reflect on
|
||||||
|
the original authors' reputations.
|
||||||
|
|
||||||
|
Finally, any free program is threatened constantly by software
|
||||||
|
patents. We wish to avoid the danger that companies distributing free
|
||||||
|
software will individually obtain patent licenses, thus in effect
|
||||||
|
transforming the program into proprietary software. To prevent this,
|
||||||
|
we have made it clear that any patent must be licensed for everyone's
|
||||||
|
free use or not licensed at all.
|
||||||
|
|
||||||
|
Most GNU software, including some libraries, is covered by the ordinary
|
||||||
|
GNU General Public License, which was designed for utility programs. This
|
||||||
|
license, the GNU Library General Public License, applies to certain
|
||||||
|
designated libraries. This license is quite different from the ordinary
|
||||||
|
one; be sure to read it in full, and don't assume that anything in it is
|
||||||
|
the same as in the ordinary license.
|
||||||
|
|
||||||
|
The reason we have a separate public license for some libraries is that
|
||||||
|
they blur the distinction we usually make between modifying or adding to a
|
||||||
|
program and simply using it. Linking a program with a library, without
|
||||||
|
changing the library, is in some sense simply using the library, and is
|
||||||
|
analogous to running a utility program or application program. However, in
|
||||||
|
a textual and legal sense, the linked executable is a combined work, a
|
||||||
|
derivative of the original library, and the ordinary General Public License
|
||||||
|
treats it as such.
|
||||||
|
|
||||||
|
Because of this blurred distinction, using the ordinary General
|
||||||
|
Public License for libraries did not effectively promote software
|
||||||
|
sharing, because most developers did not use the libraries. We
|
||||||
|
concluded that weaker conditions might promote sharing better.
|
||||||
|
|
||||||
|
However, unrestricted linking of non-free programs would deprive the
|
||||||
|
users of those programs of all benefit from the free status of the
|
||||||
|
libraries themselves. This Library General Public License is intended to
|
||||||
|
permit developers of non-free programs to use free libraries, while
|
||||||
|
preserving your freedom as a user of such programs to change the free
|
||||||
|
libraries that are incorporated in them. (We have not seen how to achieve
|
||||||
|
this as regards changes in header files, but we have achieved it as regards
|
||||||
|
changes in the actual functions of the Library.) The hope is that this
|
||||||
|
will lead to faster development of free libraries.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow. Pay close attention to the difference between a
|
||||||
|
"work based on the library" and a "work that uses the library". The
|
||||||
|
former contains code derived from the library, while the latter only
|
||||||
|
works together with the library.
|
||||||
|
|
||||||
|
Note that it is possible for a library to be covered by the ordinary
|
||||||
|
General Public License rather than by this special one.
|
||||||
|
|
||||||
|
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License Agreement applies to any software library which
|
||||||
|
contains a notice placed by the copyright holder or other authorized
|
||||||
|
party saying it may be distributed under the terms of this Library
|
||||||
|
General Public License (also called "this License"). Each licensee is
|
||||||
|
addressed as "you".
|
||||||
|
|
||||||
|
A "library" means a collection of software functions and/or data
|
||||||
|
prepared so as to be conveniently linked with application programs
|
||||||
|
(which use some of those functions and data) to form executables.
|
||||||
|
|
||||||
|
The "Library", below, refers to any such software library or work
|
||||||
|
which has been distributed under these terms. A "work based on the
|
||||||
|
Library" means either the Library or any derivative work under
|
||||||
|
copyright law: that is to say, a work containing the Library or a
|
||||||
|
portion of it, either verbatim or with modifications and/or translated
|
||||||
|
straightforwardly into another language. (Hereinafter, translation is
|
||||||
|
included without limitation in the term "modification".)
|
||||||
|
|
||||||
|
"Source code" for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For a library, complete source code means
|
||||||
|
all the source code for all modules it contains, plus any associated
|
||||||
|
interface definition files, plus the scripts used to control compilation
|
||||||
|
and installation of the library.
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running a program using the Library is not restricted, and output from
|
||||||
|
such a program is covered only if its contents constitute a work based
|
||||||
|
on the Library (independent of the use of the Library in a tool for
|
||||||
|
writing it). Whether that is true depends on what the Library does
|
||||||
|
and what the program that uses the Library does.
|
||||||
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Library's
|
||||||
|
complete source code as you receive it, in any medium, provided that
|
||||||
|
you conspicuously and appropriately publish on each copy an
|
||||||
|
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||||
|
all the notices that refer to this License and to the absence of any
|
||||||
|
warranty; and distribute a copy of this License along with the
|
||||||
|
Library.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy,
|
||||||
|
and you may at your option offer warranty protection in exchange for a
|
||||||
|
fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Library or any portion
|
||||||
|
of it, thus forming a work based on the Library, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The modified work must itself be a software library.
|
||||||
|
|
||||||
|
b) You must cause the files modified to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
c) You must cause the whole of the work to be licensed at no
|
||||||
|
charge to all third parties under the terms of this License.
|
||||||
|
|
||||||
|
d) If a facility in the modified Library refers to a function or a
|
||||||
|
table of data to be supplied by an application program that uses
|
||||||
|
the facility, other than as an argument passed when the facility
|
||||||
|
is invoked, then you must make a good faith effort to ensure that,
|
||||||
|
in the event an application does not supply such function or
|
||||||
|
table, the facility still operates, and performs whatever part of
|
||||||
|
its purpose remains meaningful.
|
||||||
|
|
||||||
|
(For example, a function in a library to compute square roots has
|
||||||
|
a purpose that is entirely well-defined independent of the
|
||||||
|
application. Therefore, Subsection 2d requires that any
|
||||||
|
application-supplied function or table used by this function must
|
||||||
|
be optional: if the application does not supply it, the square
|
||||||
|
root function must still compute square roots.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Library,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Library, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote
|
||||||
|
it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Library.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Library
|
||||||
|
with the Library (or with a work based on the Library) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||||
|
License instead of this License to a given copy of the Library. To do
|
||||||
|
this, you must alter all the notices that refer to this License, so
|
||||||
|
that they refer to the ordinary GNU General Public License, version 2,
|
||||||
|
instead of to this License. (If a newer version than version 2 of the
|
||||||
|
ordinary GNU General Public License has appeared, then you can specify
|
||||||
|
that version instead if you wish.) Do not make any other change in
|
||||||
|
these notices.
|
||||||
|
|
||||||
|
Once this change is made in a given copy, it is irreversible for
|
||||||
|
that copy, so the ordinary GNU General Public License applies to all
|
||||||
|
subsequent copies and derivative works made from that copy.
|
||||||
|
|
||||||
|
This option is useful when you wish to copy part of the code of
|
||||||
|
the Library into a program that is not a library.
|
||||||
|
|
||||||
|
4. You may copy and distribute the Library (or a portion or
|
||||||
|
derivative of it, under Section 2) in object code or executable form
|
||||||
|
under the terms of Sections 1 and 2 above provided that you accompany
|
||||||
|
it with the complete corresponding machine-readable source code, which
|
||||||
|
must be distributed under the terms of Sections 1 and 2 above on a
|
||||||
|
medium customarily used for software interchange.
|
||||||
|
|
||||||
|
If distribution of object code is made by offering access to copy
|
||||||
|
from a designated place, then offering equivalent access to copy the
|
||||||
|
source code from the same place satisfies the requirement to
|
||||||
|
distribute the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
5. A program that contains no derivative of any portion of the
|
||||||
|
Library, but is designed to work with the Library by being compiled or
|
||||||
|
linked with it, is called a "work that uses the Library". Such a
|
||||||
|
work, in isolation, is not a derivative work of the Library, and
|
||||||
|
therefore falls outside the scope of this License.
|
||||||
|
|
||||||
|
However, linking a "work that uses the Library" with the Library
|
||||||
|
creates an executable that is a derivative of the Library (because it
|
||||||
|
contains portions of the Library), rather than a "work that uses the
|
||||||
|
library". The executable is therefore covered by this License.
|
||||||
|
Section 6 states terms for distribution of such executables.
|
||||||
|
|
||||||
|
When a "work that uses the Library" uses material from a header file
|
||||||
|
that is part of the Library, the object code for the work may be a
|
||||||
|
derivative work of the Library even though the source code is not.
|
||||||
|
Whether this is true is especially significant if the work can be
|
||||||
|
linked without the Library, or if the work is itself a library. The
|
||||||
|
threshold for this to be true is not precisely defined by law.
|
||||||
|
|
||||||
|
If such an object file uses only numerical parameters, data
|
||||||
|
structure layouts and accessors, and small macros and small inline
|
||||||
|
functions (ten lines or less in length), then the use of the object
|
||||||
|
file is unrestricted, regardless of whether it is legally a derivative
|
||||||
|
work. (Executables containing this object code plus portions of the
|
||||||
|
Library will still fall under Section 6.)
|
||||||
|
|
||||||
|
Otherwise, if the work is a derivative of the Library, you may
|
||||||
|
distribute the object code for the work under the terms of Section 6.
|
||||||
|
Any executables containing that work also fall under Section 6,
|
||||||
|
whether or not they are linked directly with the Library itself.
|
||||||
|
|
||||||
|
6. As an exception to the Sections above, you may also compile or
|
||||||
|
link a "work that uses the Library" with the Library to produce a
|
||||||
|
work containing portions of the Library, and distribute that work
|
||||||
|
under terms of your choice, provided that the terms permit
|
||||||
|
modification of the work for the customer's own use and reverse
|
||||||
|
engineering for debugging such modifications.
|
||||||
|
|
||||||
|
You must give prominent notice with each copy of the work that the
|
||||||
|
Library is used in it and that the Library and its use are covered by
|
||||||
|
this License. You must supply a copy of this License. If the work
|
||||||
|
during execution displays copyright notices, you must include the
|
||||||
|
copyright notice for the Library among them, as well as a reference
|
||||||
|
directing the user to the copy of this License. Also, you must do one
|
||||||
|
of these things:
|
||||||
|
|
||||||
|
a) Accompany the work with the complete corresponding
|
||||||
|
machine-readable source code for the Library including whatever
|
||||||
|
changes were used in the work (which must be distributed under
|
||||||
|
Sections 1 and 2 above); and, if the work is an executable linked
|
||||||
|
with the Library, with the complete machine-readable "work that
|
||||||
|
uses the Library", as object code and/or source code, so that the
|
||||||
|
user can modify the Library and then relink to produce a modified
|
||||||
|
executable containing the modified Library. (It is understood
|
||||||
|
that the user who changes the contents of definitions files in the
|
||||||
|
Library will not necessarily be able to recompile the application
|
||||||
|
to use the modified definitions.)
|
||||||
|
|
||||||
|
b) Accompany the work with a written offer, valid for at
|
||||||
|
least three years, to give the same user the materials
|
||||||
|
specified in Subsection 6a, above, for a charge no more
|
||||||
|
than the cost of performing this distribution.
|
||||||
|
|
||||||
|
c) If distribution of the work is made by offering access to copy
|
||||||
|
from a designated place, offer equivalent access to copy the above
|
||||||
|
specified materials from the same place.
|
||||||
|
|
||||||
|
d) Verify that the user has already received a copy of these
|
||||||
|
materials or that you have already sent this user a copy.
|
||||||
|
|
||||||
|
For an executable, the required form of the "work that uses the
|
||||||
|
Library" must include any data and utility programs needed for
|
||||||
|
reproducing the executable from it. However, as a special exception,
|
||||||
|
the source code distributed need not include anything that is normally
|
||||||
|
distributed (in either source or binary form) with the major
|
||||||
|
components (compiler, kernel, and so on) of the operating system on
|
||||||
|
which the executable runs, unless that component itself accompanies
|
||||||
|
the executable.
|
||||||
|
|
||||||
|
It may happen that this requirement contradicts the license
|
||||||
|
restrictions of other proprietary libraries that do not normally
|
||||||
|
accompany the operating system. Such a contradiction means you cannot
|
||||||
|
use both them and the Library together in an executable that you
|
||||||
|
distribute.
|
||||||
|
|
||||||
|
7. You may place library facilities that are a work based on the
|
||||||
|
Library side-by-side in a single library together with other library
|
||||||
|
facilities not covered by this License, and distribute such a combined
|
||||||
|
library, provided that the separate distribution of the work based on
|
||||||
|
the Library and of the other library facilities is otherwise
|
||||||
|
permitted, and provided that you do these two things:
|
||||||
|
|
||||||
|
a) Accompany the combined library with a copy of the same work
|
||||||
|
based on the Library, uncombined with any other library
|
||||||
|
facilities. This must be distributed under the terms of the
|
||||||
|
Sections above.
|
||||||
|
|
||||||
|
b) Give prominent notice with the combined library of the fact
|
||||||
|
that part of it is a work based on the Library, and explaining
|
||||||
|
where to find the accompanying uncombined form of the same work.
|
||||||
|
|
||||||
|
8. You may not copy, modify, sublicense, link with, or distribute
|
||||||
|
the Library except as expressly provided under this License. Any
|
||||||
|
attempt otherwise to copy, modify, sublicense, link with, or
|
||||||
|
distribute the Library is void, and will automatically terminate your
|
||||||
|
rights under this License. However, parties who have received copies,
|
||||||
|
or rights, from you under this License will not have their licenses
|
||||||
|
terminated so long as such parties remain in full compliance.
|
||||||
|
|
||||||
|
9. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Library or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Library (or any work based on the
|
||||||
|
Library), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Library or works based on it.
|
||||||
|
|
||||||
|
10. Each time you redistribute the Library (or any work based on the
|
||||||
|
Library), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute, link with or modify the Library
|
||||||
|
subject to these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties to
|
||||||
|
this License.
|
||||||
|
|
||||||
|
11. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Library at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Library by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Library.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under any
|
||||||
|
particular circumstance, the balance of the section is intended to apply,
|
||||||
|
and the section as a whole is intended to apply in other circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
12. If the distribution and/or use of the Library is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Library under this License may add
|
||||||
|
an explicit geographical distribution limitation excluding those countries,
|
||||||
|
so that distribution is permitted only in or among countries not thus
|
||||||
|
excluded. In such case, this License incorporates the limitation as if
|
||||||
|
written in the body of this License.
|
||||||
|
|
||||||
|
13. The Free Software Foundation may publish revised and/or new
|
||||||
|
versions of the Library General Public License from time to time.
|
||||||
|
Such new versions will be similar in spirit to the present version,
|
||||||
|
but may differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Library
|
||||||
|
specifies a version number of this License which applies to it and
|
||||||
|
"any later version", you have the option of following the terms and
|
||||||
|
conditions either of that version or of any later version published by
|
||||||
|
the Free Software Foundation. If the Library does not specify a
|
||||||
|
license version number, you may choose any version ever published by
|
||||||
|
the Free Software Foundation.
|
||||||
|
|
||||||
|
14. If you wish to incorporate parts of the Library into other free
|
||||||
|
programs whose distribution conditions are incompatible with these,
|
||||||
|
write to the author to ask for permission. For software which is
|
||||||
|
copyrighted by the Free Software Foundation, write to the Free
|
||||||
|
Software Foundation; we sometimes make exceptions for this. Our
|
||||||
|
decision will be guided by the two goals of preserving the free status
|
||||||
|
of all derivatives of our free software and of promoting the sharing
|
||||||
|
and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||||
|
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||||
|
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||||
|
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||||
|
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||||
|
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||||
|
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||||
|
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||||
|
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||||
|
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||||
|
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||||
|
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||||
|
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||||
|
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||||
|
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
DAMAGES.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
Appendix: How to Apply These Terms to Your New Libraries
|
||||||
|
|
||||||
|
If you develop a new library, and you want it to be of the greatest
|
||||||
|
possible use to the public, we recommend making it free software that
|
||||||
|
everyone can redistribute and change. You can do so by permitting
|
||||||
|
redistribution under these terms (or, alternatively, under the terms of the
|
||||||
|
ordinary General Public License).
|
||||||
|
|
||||||
|
To apply these terms, attach the following notices to the library. It is
|
||||||
|
safest to attach them to the start of each source file to most effectively
|
||||||
|
convey the exclusion of warranty; and each file should have at least the
|
||||||
|
"copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the library's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with this library; if not, write to the Free
|
||||||
|
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||||
|
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||||
|
|
||||||
|
<signature of Ty Coon>, 1 April 1990
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
That's all there is to it!
|
||||||
|
|
||||||
@@ -1,3 +1,11 @@
|
|||||||
|
January 18, 1999, V2.50:
|
||||||
|
* Added autoconf/automake/libtool support
|
||||||
|
* Licensing moved to LGPL
|
||||||
|
* Added OpenLink code enhancements and bug fixes
|
||||||
|
|
||||||
|
------------------------------------------------------------------------
|
||||||
|
Original Changelog from Ke Jin
|
||||||
|
------------------------------------------------------------------------
|
||||||
July 30, 1995, v2.00.beta:
|
July 30, 1995, v2.00.beta:
|
||||||
0. the first release and beta version.
|
0. the first release and beta version.
|
||||||
|
|
||||||
@@ -56,3 +64,4 @@ Nov. 12, 1995, v2.12
|
|||||||
dld.h -> dlf.h
|
dld.h -> dlf.h
|
||||||
confg.h -> config.h
|
confg.h -> config.h
|
||||||
16. Fix a bug on setting tracing options.
|
16. Fix a bug on setting tracing options.
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
#
|
|
||||||
# Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
|
||||||
#
|
|
||||||
|
|
||||||
#============ Default for all system ==============
|
|
||||||
SHELL =
|
|
||||||
SHELL = /bin/sh
|
|
||||||
DLDAPI = DLDAPI_SVR4_DLFCN
|
|
||||||
DLSUFFIX= so
|
|
||||||
OUTFILE = iodbc
|
|
||||||
OBJX =
|
|
||||||
|
|
||||||
#============= Linux ELF =========================
|
|
||||||
# Slackware 2.x,(kernel 1.3.x) on i386
|
|
||||||
# Red Hat 2.x (kernel 1.2.x) on i486
|
|
||||||
#
|
|
||||||
ANSI = -ansi
|
|
||||||
CC = gcc
|
|
||||||
PIC = -fPIC
|
|
||||||
LDFLAGS = -shared
|
|
||||||
LIBS = -ldl
|
|
||||||
@@ -1,19 +1,22 @@
|
|||||||
Title: iODBC Driver Manager for Unix
|
Title: iODBC Driver Manager
|
||||||
|
|
||||||
Version: 2.12.0
|
Version: 2.50
|
||||||
|
|
||||||
Description: iODBC (intrinsic Open Database Connectivity) driver manager
|
Description: iODBC (intrinsic Open Database Connectivity) driver manager
|
||||||
is compatible with ODBC 2.0 specification and performs exactly
|
is compatible with ODBC 2.x specification and performs exactly
|
||||||
same jobs of ODBC 2.0 driver manager(i.e driver loading,
|
same jobs of ODBC 2.x driver manager(i.e. driver loading,
|
||||||
parameters and function sequence checking, driver's function
|
Parameters and function sequence checking, driver's function
|
||||||
invoking, etc.). Any ODBC driver works with ODBC 2.0 driver
|
Invoking, etc.). Any ODBC driver works with ODBC 2.0 driver
|
||||||
manager will also work with iODBC driver manager and vice versa.
|
Manager will also work with iODBC driver manager and vice versa.
|
||||||
Applications(which using ODBC function calls) linked with
|
Applications (using ODBC function calls) linked with
|
||||||
iODBC driver manager will be able to simultaneously access
|
iODBC driver manager will be able to simultaneously access
|
||||||
different type of data sources within one process through
|
different type of data sources within one process through
|
||||||
suitable ODBC drivers.
|
suitable iODBC drivers.
|
||||||
|
|
||||||
Author: Jin, Ke <kejin@empress.com>
|
Original Author: Jin, Ke
|
||||||
|
Source Code Enhancement Contributors: OpenLink Software
|
||||||
|
Maintainers: OpenLink Software
|
||||||
|
Web Site: http://www.openlinksw.com
|
||||||
|
|
||||||
Platforms: SunOS (Sparc) 4.1.x
|
Platforms: SunOS (Sparc) 4.1.x
|
||||||
HP/UX (s700/s800) 9.x, 10.x
|
HP/UX (s700/s800) 9.x, 10.x
|
||||||
@@ -32,6 +35,6 @@ Platforms: SunOS (Sparc) 4.1.x
|
|||||||
Concurrent MAX/OS 1.x
|
Concurrent MAX/OS 1.x
|
||||||
DG/UX 5.x
|
DG/UX 5.x
|
||||||
|
|
||||||
Copying-Policy: Freely Redistributable under GNU General Public License
|
License Policy: Freely Redistributable under GNU Library General Public License (LGPL)
|
||||||
|
|
||||||
Keywords: ODBC, database, SQL
|
Keywords: ODBC, database, SQL, OpenLink
|
||||||
|
|||||||
182
src/iodbc/INSTALL
Normal file
182
src/iodbc/INSTALL
Normal file
@@ -0,0 +1,182 @@
|
|||||||
|
Basic Installation
|
||||||
|
==================
|
||||||
|
|
||||||
|
These are generic installation instructions.
|
||||||
|
|
||||||
|
The `configure' shell script attempts to guess correct values for
|
||||||
|
various system-dependent variables used during compilation. It uses
|
||||||
|
those values to create a `Makefile' in each directory of the package.
|
||||||
|
It may also create one or more `.h' files containing system-dependent
|
||||||
|
definitions. Finally, it creates a shell script `config.status' that
|
||||||
|
you can run in the future to recreate the current configuration, a file
|
||||||
|
`config.cache' that saves the results of its tests to speed up
|
||||||
|
reconfiguring, and a file `config.log' containing compiler output
|
||||||
|
(useful mainly for debugging `configure').
|
||||||
|
|
||||||
|
If you need to do unusual things to compile the package, please try
|
||||||
|
to figure out how `configure' could check whether to do them, and mail
|
||||||
|
diffs or instructions to the address given in the `README' so they can
|
||||||
|
be considered for the next release. If at some point `config.cache'
|
||||||
|
contains results you don't want to keep, you may remove or edit it.
|
||||||
|
|
||||||
|
The file `configure.in' is used to create `configure' by a program
|
||||||
|
called `autoconf'. You only need `configure.in' if you want to change
|
||||||
|
it or regenerate `configure' using a newer version of `autoconf'.
|
||||||
|
|
||||||
|
The simplest way to compile this package is:
|
||||||
|
|
||||||
|
1. `cd' to the directory containing the package's source code and type
|
||||||
|
`./configure' to configure the package for your system. If you're
|
||||||
|
using `csh' on an old version of System V, you might need to type
|
||||||
|
`sh ./configure' instead to prevent `csh' from trying to execute
|
||||||
|
`configure' itself.
|
||||||
|
|
||||||
|
Running `configure' takes awhile. While running, it prints some
|
||||||
|
messages telling which features it is checking for.
|
||||||
|
|
||||||
|
2. Type `make' to compile the package.
|
||||||
|
|
||||||
|
3. Optionally, type `make check' to run any self-tests that come with
|
||||||
|
the package.
|
||||||
|
|
||||||
|
4. Type `make install' to install the programs and any data files and
|
||||||
|
documentation.
|
||||||
|
|
||||||
|
5. You can remove the program binaries and object files from the
|
||||||
|
source code directory by typing `make clean'. To also remove the
|
||||||
|
files that `configure' created (so you can compile the package for
|
||||||
|
a different kind of computer), type `make distclean'. There is
|
||||||
|
also a `make maintainer-clean' target, but that is intended mainly
|
||||||
|
for the package's developers. If you use it, you may have to get
|
||||||
|
all sorts of other programs in order to regenerate files that came
|
||||||
|
with the distribution.
|
||||||
|
|
||||||
|
Compilers and Options
|
||||||
|
=====================
|
||||||
|
|
||||||
|
Some systems require unusual options for compilation or linking that
|
||||||
|
the `configure' script does not know about. You can give `configure'
|
||||||
|
initial values for variables by setting them in the environment. Using
|
||||||
|
a Bourne-compatible shell, you can do that on the command line like
|
||||||
|
this:
|
||||||
|
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
|
||||||
|
|
||||||
|
Or on systems that have the `env' program, you can do it like this:
|
||||||
|
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
|
||||||
|
|
||||||
|
Compiling For Multiple Architectures
|
||||||
|
====================================
|
||||||
|
|
||||||
|
You can compile the package for more than one kind of computer at the
|
||||||
|
same time, by placing the object files for each architecture in their
|
||||||
|
own directory. To do this, you must use a version of `make' that
|
||||||
|
supports the `VPATH' variable, such as GNU `make'. `cd' to the
|
||||||
|
directory where you want the object files and executables to go and run
|
||||||
|
the `configure' script. `configure' automatically checks for the
|
||||||
|
source code in the directory that `configure' is in and in `..'.
|
||||||
|
|
||||||
|
If you have to use a `make' that does not supports the `VPATH'
|
||||||
|
variable, you have to compile the package for one architecture at a time
|
||||||
|
in the source code directory. After you have installed the package for
|
||||||
|
one architecture, use `make distclean' before reconfiguring for another
|
||||||
|
architecture.
|
||||||
|
|
||||||
|
Installation Names
|
||||||
|
==================
|
||||||
|
|
||||||
|
By default, `make install' will install the package's files in
|
||||||
|
`/usr/local/bin', `/usr/local/man', etc. You can specify an
|
||||||
|
installation prefix other than `/usr/local' by giving `configure' the
|
||||||
|
option `--prefix=PATH'.
|
||||||
|
|
||||||
|
You can specify separate installation prefixes for
|
||||||
|
architecture-specific files and architecture-independent files. If you
|
||||||
|
give `configure' the option `--exec-prefix=PATH', the package will use
|
||||||
|
PATH as the prefix for installing programs and libraries.
|
||||||
|
Documentation and other data files will still use the regular prefix.
|
||||||
|
|
||||||
|
In addition, if you use an unusual directory layout you can give
|
||||||
|
options like `--bindir=PATH' to specify different values for particular
|
||||||
|
kinds of files. Run `configure --help' for a list of the directories
|
||||||
|
you can set and what kinds of files go in them.
|
||||||
|
|
||||||
|
If the package supports it, you can cause programs to be installed
|
||||||
|
with an extra prefix or suffix on their names by giving `configure' the
|
||||||
|
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
||||||
|
|
||||||
|
Optional Features
|
||||||
|
=================
|
||||||
|
|
||||||
|
Some packages pay attention to `--enable-FEATURE' options to
|
||||||
|
`configure', where FEATURE indicates an optional part of the package.
|
||||||
|
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
||||||
|
is something like `gnu-as' or `x' (for the X Window System). The
|
||||||
|
`README' should mention any `--enable-' and `--with-' options that the
|
||||||
|
package recognizes.
|
||||||
|
|
||||||
|
For packages that use the X Window System, `configure' can usually
|
||||||
|
find the X include and library files automatically, but if it doesn't,
|
||||||
|
you can use the `configure' options `--x-includes=DIR' and
|
||||||
|
`--x-libraries=DIR' to specify their locations.
|
||||||
|
|
||||||
|
Specifying the System Type
|
||||||
|
==========================
|
||||||
|
|
||||||
|
There may be some features `configure' can not figure out
|
||||||
|
automatically, but needs to determine by the type of host the package
|
||||||
|
will run on. Usually `configure' can figure that out, but if it prints
|
||||||
|
a message saying it can not guess the host type, give it the
|
||||||
|
`--host=TYPE' option. TYPE can either be a short name for the system
|
||||||
|
type, such as `sun4', or a canonical name with three fields:
|
||||||
|
CPU-COMPANY-SYSTEM
|
||||||
|
|
||||||
|
See the file `config.sub' for the possible values of each field. If
|
||||||
|
`config.sub' isn't included in this package, then this package doesn't
|
||||||
|
need to know the host type.
|
||||||
|
|
||||||
|
If you are building compiler tools for cross-compiling, you can also
|
||||||
|
use the `--target=TYPE' option to select the type of system they will
|
||||||
|
produce code for and the `--build=TYPE' option to select the type of
|
||||||
|
system on which you are compiling the package.
|
||||||
|
|
||||||
|
Sharing Defaults
|
||||||
|
================
|
||||||
|
|
||||||
|
If you want to set default values for `configure' scripts to share,
|
||||||
|
you can create a site shell script called `config.site' that gives
|
||||||
|
default values for variables like `CC', `cache_file', and `prefix'.
|
||||||
|
`configure' looks for `PREFIX/share/config.site' if it exists, then
|
||||||
|
`PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||||
|
`CONFIG_SITE' environment variable to the location of the site script.
|
||||||
|
A warning: not all `configure' scripts look for a site script.
|
||||||
|
|
||||||
|
Operation Controls
|
||||||
|
==================
|
||||||
|
|
||||||
|
`configure' recognizes the following options to control how it
|
||||||
|
operates.
|
||||||
|
|
||||||
|
`--cache-file=FILE'
|
||||||
|
Use and save the results of the tests in FILE instead of
|
||||||
|
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
|
||||||
|
debugging `configure'.
|
||||||
|
|
||||||
|
`--help'
|
||||||
|
Print a summary of the options to `configure', and exit.
|
||||||
|
|
||||||
|
`--quiet'
|
||||||
|
`--silent'
|
||||||
|
`-q'
|
||||||
|
Do not print messages saying which checks are being made. To
|
||||||
|
suppress all normal output, redirect it to `/dev/null' (any error
|
||||||
|
messages will still be shown).
|
||||||
|
|
||||||
|
`--srcdir=DIR'
|
||||||
|
Look for the package's source code in directory DIR. Usually
|
||||||
|
`configure' can determine that directory automatically.
|
||||||
|
|
||||||
|
`--version'
|
||||||
|
Print the version of Autoconf used to generate the `configure'
|
||||||
|
script, and exit.
|
||||||
|
|
||||||
|
`configure' also accepts some other, not widely useful, options.
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
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)
|
|
||||||
|
|
||||||
delete: clean
|
|
||||||
|
|
||||||
delete_all: delete
|
|
||||||
|
|
||||||
misc.o: misc.c
|
|
||||||
$(CC) $(CFLAGS) -DFIX_INI_FILE -DDIR_INI_FILE=\"$(ODBC_LIBPATH)\" -c $<
|
|
||||||
|
|
||||||
$(ODBC_LIBPATH)/lib$(OUTFILE).a: $(OBJS)
|
|
||||||
$(AR) $(ODBC_LIBPATH)/lib$(OUTFILE).a $(OBJS)
|
|
||||||
$(RANLIB) $(ODBC_LIBPATH)/lib$(OUTFILE).a
|
|
||||||
|
|
||||||
$(ODBCDM): $(OBJS)
|
|
||||||
@echo "Generating iODBC driver manager -->" $(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
|
|
||||||
|
|
||||||
8
src/iodbc/NEWS
Normal file
8
src/iodbc/NEWS
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
Version: 2.5
|
||||||
|
-------------
|
||||||
|
Added OpenLink enhancements
|
||||||
|
|
||||||
|
|
||||||
|
Version: 2.12
|
||||||
|
-------------
|
||||||
|
Original version of Ke Jin
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
VERSION = 2.12
|
|
||||||
EXTVER = .0
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
#! /bin/sh
|
|
||||||
|
|
||||||
echo autoconfig $1
|
|
||||||
|
|
||||||
if sh ./autoconfig $1
|
|
||||||
then
|
|
||||||
echo make
|
|
||||||
make
|
|
||||||
fi
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,106 +1,93 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* config.h
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Configuration
|
||||||
|
*
|
||||||
|
* The iODBC driver manager.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free
|
||||||
|
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
#ifndef _CONFIG_H
|
#ifndef _CONFIG_H
|
||||||
#define _CONFIG_H
|
#define _CONFIG_H
|
||||||
|
|
||||||
# if !defined(WINDOWS) && !defined(WIN32_SYSTEM) && !defined(OS2)
|
#if !defined(WINDOWS) && !defined(WIN32_SYSTEM)
|
||||||
# define _UNIX_
|
#define _UNIX_
|
||||||
|
|
||||||
# include <stdlib.h>
|
#include "wx/setup.h"
|
||||||
# include <sys/types.h>
|
|
||||||
# include <string.h>
|
|
||||||
# include <stdio.h>
|
|
||||||
|
|
||||||
# define MEM_ALLOC(size) (malloc((size_t)(size)))
|
#include <stdlib.h>
|
||||||
# define MEM_FREE(ptr) {if(ptr) free(ptr);}
|
#include <sys/types.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
# define STRCPY(t, s) (strcpy((char*)(t), (char*)(s)))
|
#define MEM_ALLOC(size) (malloc((size_t)(size)))
|
||||||
# define STRNCPY(t,s,n) (strncpy((char*)(t), (char*)(s), (size_t)(n)))
|
#define MEM_FREE(ptr) {if(ptr) free(ptr);}
|
||||||
# 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)
|
|
||||||
|
|
||||||
# define EXPORT
|
#define STRCPY(t, s) (strcpy((char*)(t), (char*)(s)))
|
||||||
# define CALLBACK
|
#define STRNCPY(t,s,n) (strncpy((char*)(t), (char*)(s), (size_t)(n)))
|
||||||
# define FAR
|
#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)
|
||||||
|
|
||||||
typedef signed short SSHOR;
|
#define EXPORT
|
||||||
typedef short WORD;
|
#define CALLBACK
|
||||||
typedef long DWORD;
|
#define FAR
|
||||||
|
|
||||||
typedef WORD WPARAM;
|
typedef signed short SSHOR;
|
||||||
typedef DWORD LPARAM;
|
typedef short WORD;
|
||||||
// KB: I don't see where HWND and BOOL could get defined before here,
|
typedef long DWORD;
|
||||||
// but putting in the #ifndef's solved the compilation problem on Solaris.
|
|
||||||
#ifndef HWND
|
typedef WORD WPARAM;
|
||||||
typedef void* HWND;
|
typedef DWORD LPARAM;
|
||||||
#endif
|
|
||||||
#ifndef BOOL
|
|
||||||
typedef int BOOL;
|
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
|
#endif
|
||||||
|
|
||||||
# endif /* _UNIX_ */
|
#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
|
||||||
|
|
||||||
# if defined(WINDOWS) || defined(WIN32_SYSTEM)
|
#endif /* WINDOWS */
|
||||||
|
|
||||||
# include <windows.h>
|
#define SYSERR (-1)
|
||||||
# include <windowsx.h>
|
|
||||||
|
|
||||||
# ifdef _MSVC_
|
#ifndef NULL
|
||||||
# define MEM_ALLOC(size) (fmalloc((size_t)(size)))
|
#define NULL ((void FAR*)0UL)
|
||||||
# define MEM_FREE(ptr) ((ptr)? ffree((PTR)(ptr)):0))
|
#endif
|
||||||
# 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;
|
|
||||||
|
|
||||||
typedef WORD WPARAM;
|
|
||||||
typedef DWORD LPARAM;
|
|
||||||
|
|
||||||
# endif /* OS2 */
|
|
||||||
|
|
||||||
# define SYSERR (-1)
|
|
||||||
|
|
||||||
# ifndef NULL
|
|
||||||
# define NULL ((void FAR*)0UL)
|
|
||||||
# endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
493
src/iodbc/dlf.c
493
src/iodbc/dlf.c
@@ -1,35 +1,38 @@
|
|||||||
/** dynamic library loader (mapping to svr4)
|
/*
|
||||||
|
* dlf.c
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Dynamic Library Loader (mapping to SVR4)
|
||||||
|
*
|
||||||
|
* The iODBC driver manager.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free
|
||||||
|
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
#include <dlf.h>
|
||||||
|
|
||||||
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
|
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
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 "wx/setup.h"
|
|
||||||
#include <../iodbc/dlf.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#ifdef DLDAPI_DEFINED
|
#ifdef DLDAPI_DEFINED
|
||||||
# undef DLDAPI_DEFINED
|
#undef DLDAPI_DEFINED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DLDAPI_SVR4_DLFCN
|
#ifdef DLDAPI_SVR4_DLFCN
|
||||||
# define DLDAPI_DEFINED
|
#define DLDAPI_DEFINED
|
||||||
static char sccsid[] = "@(#)dynamic load interface -- SVR4 dlfcn";
|
static char sccsid[] = "@(#)dynamic load interface -- SVR4 dlfcn";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -38,62 +41,72 @@ static char sccsid[] = "@(#)dynamic load interface -- SVR4 dlfcn";
|
|||||||
* HP/UX
|
* HP/UX
|
||||||
*
|
*
|
||||||
*********************************/
|
*********************************/
|
||||||
|
|
||||||
#ifdef DLDAPI_HP_SHL
|
#ifdef DLDAPI_HP_SHL
|
||||||
# define DLDAPI_DEFINED
|
#define DLDAPI_DEFINED
|
||||||
# include <dl.h>
|
#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;
|
void *symaddr = 0;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if( ! hdll )
|
if (!hdll)
|
||||||
hdll = (void*)PROG_HANDLE;
|
hdll = (void *) PROG_HANDLE;
|
||||||
|
|
||||||
/* Remember, a driver may export calls as function pointers
|
/* Remember, a driver may export calls as function pointers
|
||||||
* (i.e. with type TYPE_DATA) rather than as functions
|
* (i.e. with type TYPE_DATA) rather than as functions
|
||||||
* (i.e. with type TYPE_PROCEDURE). Thus, to be safe, we
|
* (i.e. with type TYPE_PROCEDURE). Thus, to be safe, we
|
||||||
* uses TYPE_UNDEFINED to cover all of them.
|
* uses TYPE_UNDEFINED to cover all of them.
|
||||||
*/
|
*/
|
||||||
ret = shl_findsym((shl_t*)&hdll, sym, TYPE_UNDEFINED, &symaddr);
|
ret = shl_findsym ((shl_t *) & hdll, sym, TYPE_UNDEFINED, &symaddr);
|
||||||
|
|
||||||
if( ret == -1 )
|
if (ret == -1)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return symaddr;
|
return symaddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* dlerror()
|
|
||||||
{
|
|
||||||
extern char* strerror();
|
|
||||||
|
|
||||||
return strerror(errno);
|
char *
|
||||||
|
dlerror ()
|
||||||
|
{
|
||||||
|
extern char *strerror ();
|
||||||
|
|
||||||
|
return strerror (errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
int dlclose(void* hdll)
|
|
||||||
{
|
|
||||||
return shl_unload((shl_t)hdll);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
int
|
||||||
|
dlclose (void *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
|
#ifdef DLDAPI_AIX_LOAD
|
||||||
# define DLDAPI_DEFINED
|
#define DLDAPI_DEFINED
|
||||||
# include <sys/ldr.h>
|
#include <sys/types.h>
|
||||||
# include <sys/stat.h>
|
#include <sys/ldr.h>
|
||||||
# include <nlist.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
|
||||||
@@ -103,24 +116,25 @@ int dlclose(void* hdll)
|
|||||||
* are copyright violation.
|
* are copyright violation.
|
||||||
*/
|
*/
|
||||||
static char sccsid[]
|
static char sccsid[]
|
||||||
= "@(#)dynamic load interface, Copyright(c) 1995 by Ke Jin";
|
= "@(#)dynamic load interface, Copyright(c) 1995 by Ke Jin";
|
||||||
|
|
||||||
# ifndef HTAB_SIZE
|
#ifndef HTAB_SIZE
|
||||||
# define HTAB_SIZE 256
|
#define HTAB_SIZE 256
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
# define FACTOR 0.618039887 /* i.e. (sqrt(5) - 1)/2 */
|
#define FACTOR 0.618039887 /* i.e. (sqrt(5) - 1)/2 */
|
||||||
|
|
||||||
# ifndef ENTRY_SYM
|
#ifndef ENTRY_SYM
|
||||||
# define ENTRY_SYM ".__start" /* default entry point for aix */
|
#define ENTRY_SYM ".__start" /* default entry point for aix */
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
typedef struct slot_s
|
typedef struct slot_s
|
||||||
{
|
{
|
||||||
char* sym;
|
char *sym;
|
||||||
long fdesc[3]; /* 12 bytes function descriptor */
|
long fdesc[3]; /* 12 bytes function descriptor */
|
||||||
struct slot_s* next;
|
struct slot_s *next;
|
||||||
} slot_t;
|
}
|
||||||
|
slot_t;
|
||||||
|
|
||||||
/* Note: on AIX, a function pointer actually points to a
|
/* Note: on AIX, a function pointer actually points to a
|
||||||
* function descriptor, a 12 bytes data. The first 4 bytes
|
* function descriptor, a 12 bytes data. The first 4 bytes
|
||||||
@@ -141,50 +155,53 @@ typedef struct slot_s
|
|||||||
* the module library file).
|
* the module library file).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef slot_t* hent_t;
|
typedef slot_t *hent_t;
|
||||||
typedef struct nlist nlist_t;
|
typedef struct nlist nlist_t;
|
||||||
typedef struct stat stat_t;
|
typedef struct stat stat_t;
|
||||||
|
|
||||||
typedef struct obj
|
typedef struct obj
|
||||||
{
|
{
|
||||||
int dev; /* device id */
|
int dev; /* device id */
|
||||||
int ino; /* inode number */
|
int ino; /* inode number */
|
||||||
char* path; /* file name */
|
char *path; /* file name */
|
||||||
int (*pentry)(); /* entry point of this share library */
|
int (*pentry) (); /* entry point of this share library */
|
||||||
int refn; /* number of reference */
|
int refn; /* number of reference */
|
||||||
hent_t htab[HTAB_SIZE];
|
hent_t htab[HTAB_SIZE];
|
||||||
struct obj*
|
struct obj * next;
|
||||||
next;
|
}
|
||||||
} obj_t;
|
obj_t;
|
||||||
|
|
||||||
static char* errmsg = 0;
|
static char *errmsg = 0;
|
||||||
|
|
||||||
static void init_htab(hent_t* ht)
|
static void
|
||||||
|
init_htab (hent_t * ht)
|
||||||
/* initate a hashing table */
|
/* initate a hashing table */
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i=0; i<HTAB_SIZE; i++)
|
for (i = 0; i < HTAB_SIZE; i++)
|
||||||
ht[i] = (slot_t*)0;
|
ht[i] = (slot_t *) 0;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void clean_htab(hent_t* ht)
|
|
||||||
|
static void
|
||||||
|
clean_htab (hent_t * ht)
|
||||||
/* free all slots */
|
/* free all slots */
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
slot_t* ent;
|
slot_t *ent;
|
||||||
slot_t* tent;
|
slot_t *tent;
|
||||||
|
|
||||||
for(i = 0; i< HTAB_SIZE; i++)
|
for (i = 0; i < HTAB_SIZE; i++)
|
||||||
{
|
{
|
||||||
for( ent = ht[i]; ent; )
|
for (ent = ht[i]; ent;)
|
||||||
{
|
{
|
||||||
tent = ent->next;
|
tent = ent->next;
|
||||||
|
|
||||||
free(ent->sym);
|
free (ent->sym);
|
||||||
free(ent);
|
free (ent);
|
||||||
|
|
||||||
ent = tent;
|
ent = tent;
|
||||||
}
|
}
|
||||||
@@ -195,52 +212,58 @@ static void clean_htab(hent_t* ht)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hash(char* sym )
|
|
||||||
|
static int
|
||||||
|
hash (char *sym)
|
||||||
{
|
{
|
||||||
int a, key;
|
int a, key;
|
||||||
double f;
|
double f;
|
||||||
|
|
||||||
if( !sym || !*sym )
|
if (!sym || !*sym)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for(key=*sym;*sym;sym++)
|
for (key = *sym; *sym; sym++)
|
||||||
{
|
{
|
||||||
key += *sym;
|
key += *sym;
|
||||||
a = key;
|
a = key;
|
||||||
|
|
||||||
key = (int)( (a<<8) + (key>>8) );
|
key = (int) ((a << 8) + (key >> 8));
|
||||||
key = (key>0)? key:-key;
|
key = (key > 0) ? key : -key;
|
||||||
}
|
}
|
||||||
|
|
||||||
f = key*FACTOR;
|
f = key * FACTOR;
|
||||||
a = (int)f;
|
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 */
|
/* search hashing table to find a matched slot */
|
||||||
{
|
{
|
||||||
int key;
|
int key;
|
||||||
slot_t* ent;
|
slot_t *ent;
|
||||||
|
|
||||||
key = hash(sym);
|
key = hash (sym);
|
||||||
|
|
||||||
for(ent = htab[key]; ent; ent = ent->next )
|
for (ent = htab[key]; ent; ent = ent->next)
|
||||||
{
|
{
|
||||||
if(!strcmp(ent->sym, sym))
|
if (!strcmp (ent->sym, sym))
|
||||||
return ent;
|
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 */
|
/* insert a new slot to hashing table */
|
||||||
{
|
{
|
||||||
int key;
|
int key;
|
||||||
|
|
||||||
key = hash(ent->sym);
|
key = hash (ent->sym);
|
||||||
|
|
||||||
ent->next = htab[key];
|
ent->next = htab[key];
|
||||||
htab[key] = ent;
|
htab[key] = ent;
|
||||||
@@ -248,35 +271,39 @@ static void insert(hent_t* htab, slot_t* ent)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static slot_t* slot_alloc(char* sym)
|
|
||||||
|
static slot_t *
|
||||||
|
slot_alloc (char *sym)
|
||||||
/* allocate a new slot with symbol */
|
/* 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 )
|
if (!ent->sym)
|
||||||
{
|
{
|
||||||
free(ent);
|
free (ent);
|
||||||
return 0;
|
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 )
|
static obj_t *obj_list = 0;
|
||||||
|
|
||||||
|
void *
|
||||||
|
dlopen (char *file, int mode)
|
||||||
{
|
{
|
||||||
stat_t st;
|
stat_t st;
|
||||||
obj_t* pobj;
|
obj_t *pobj;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
if( ! file || ! *file )
|
if (!file || !*file)
|
||||||
{
|
{
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return 0;
|
return 0;
|
||||||
@@ -285,81 +312,52 @@ void* dlopen(char* file, int mode )
|
|||||||
errno = 0;
|
errno = 0;
|
||||||
errmsg = 0;
|
errmsg = 0;
|
||||||
|
|
||||||
#if 0
|
if (stat (file, &st))
|
||||||
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;
|
return 0;
|
||||||
|
|
||||||
for( pobj = obj_list; pobj; pobj = pobj->next )
|
for (pobj = obj_list; pobj; pobj = pobj->next)
|
||||||
/* find a match object */
|
/* find a match object */
|
||||||
{
|
{
|
||||||
if( pobj->ino == st.st_ino
|
if (pobj->ino == st.st_ino
|
||||||
&& pobj->dev == st.st_dev )
|
&& pobj->dev == st.st_dev)
|
||||||
{
|
{
|
||||||
/* found a match. increase its
|
/* found a match. increase its
|
||||||
* reference count and return
|
* reference count and return
|
||||||
* its address */
|
* its address */
|
||||||
pobj->refn ++;
|
pobj->refn++;
|
||||||
return pobj;
|
return pobj;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pobj = (obj_t*)malloc( sizeof(obj_t) );
|
pobj = (obj_t *) malloc (sizeof (obj_t));
|
||||||
|
|
||||||
if( ! pobj )
|
if (!pobj)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
pobj->path = (char*)malloc( strlen(file) + 1);
|
pobj->path = (char *) malloc (strlen (file) + 1);
|
||||||
|
|
||||||
if( ! pobj->path )
|
if (!pobj->path)
|
||||||
{
|
{
|
||||||
free( pobj );
|
free (pobj);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy( pobj->path, file );
|
strcpy (pobj->path, file);
|
||||||
|
|
||||||
pobj->dev = st.st_dev;
|
pobj->dev = st.st_dev;
|
||||||
pobj->ino = st.st_ino;
|
pobj->ino = st.st_ino;
|
||||||
pobj->refn = 1;
|
pobj->refn = 1;
|
||||||
|
|
||||||
pobj->pentry = (int(*)())load(file, 0, 0);
|
pobj->pentry = (int (*)()) load (file, 0, 0);
|
||||||
|
|
||||||
if( ! pobj->pentry )
|
if (!pobj->pentry)
|
||||||
{
|
{
|
||||||
free( pobj->path );
|
free (pobj->path);
|
||||||
free( pobj );
|
free (pobj);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
init_htab(pobj->htab);
|
init_htab (pobj->htab);
|
||||||
|
|
||||||
pobj->next = obj_list;
|
pobj->next = obj_list;
|
||||||
obj_list = pobj;
|
obj_list = pobj;
|
||||||
@@ -367,13 +365,15 @@ void* dlopen(char* file, int mode )
|
|||||||
return pobj;
|
return pobj;
|
||||||
}
|
}
|
||||||
|
|
||||||
int dlclose(void* hobj)
|
|
||||||
|
int
|
||||||
|
dlclose (void *hobj)
|
||||||
{
|
{
|
||||||
obj_t* pobj = (obj_t*)hobj;
|
obj_t *pobj = (obj_t *) hobj;
|
||||||
obj_t* tpobj;
|
obj_t *tpobj;
|
||||||
int match = 0;
|
int match = 0;
|
||||||
|
|
||||||
if( ! hobj )
|
if (!hobj)
|
||||||
{
|
{
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return -1;
|
return -1;
|
||||||
@@ -382,24 +382,24 @@ int dlclose(void* hobj)
|
|||||||
errno = 0;
|
errno = 0;
|
||||||
errmsg = 0;
|
errmsg = 0;
|
||||||
|
|
||||||
if( pobj == obj_list )
|
if (pobj == obj_list)
|
||||||
{
|
{
|
||||||
pobj->refn --;
|
pobj->refn--;
|
||||||
|
|
||||||
if( pobj->refn )
|
if (pobj->refn)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
match = 1;
|
match = 1;
|
||||||
obj_list = pobj->next;
|
obj_list = pobj->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( tpobj = obj_list; !match && tpobj; tpobj = tpobj->next )
|
for (tpobj = obj_list; !match && tpobj; tpobj = tpobj->next)
|
||||||
{
|
{
|
||||||
if( tpobj->next == pobj )
|
if (tpobj->next == pobj)
|
||||||
{
|
{
|
||||||
pobj->refn --;
|
pobj->refn--;
|
||||||
|
|
||||||
if( pobj->refn )
|
if (pobj->refn)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
match = 1;
|
match = 1;
|
||||||
@@ -407,24 +407,26 @@ int dlclose(void* hobj)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(match)
|
if (match)
|
||||||
{
|
{
|
||||||
unload((void*)(pobj->pentry));
|
unload ((void *) (pobj->pentry));
|
||||||
clean_htab(pobj->htab);
|
clean_htab (pobj->htab);
|
||||||
free(pobj->path);
|
free (pobj->path);
|
||||||
free(pobj);
|
free (pobj);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* dlerror()
|
|
||||||
{
|
|
||||||
extern char* sys_errlist[];
|
|
||||||
|
|
||||||
if( ! errmsg || ! errmsg[0] )
|
char *
|
||||||
|
dlerror ()
|
||||||
|
{
|
||||||
|
extern char *sys_errlist[];
|
||||||
|
|
||||||
|
if (!errmsg || !errmsg[0])
|
||||||
{
|
{
|
||||||
if( errno >= 0 )
|
if (errno >= 0)
|
||||||
return sys_errlist[errno];
|
return sys_errlist[errno];
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
@@ -433,15 +435,17 @@ char* dlerror()
|
|||||||
return errmsg;
|
return errmsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* dlsym(void* hdl, char* sym)
|
|
||||||
|
void *
|
||||||
|
dlsym (void *hdl, char *sym)
|
||||||
{
|
{
|
||||||
nlist_t nl[3];
|
nlist_t nl[3];
|
||||||
obj_t* pobj = (obj_t*)hdl;
|
obj_t *pobj = (obj_t *) hdl;
|
||||||
slot_t* ent;
|
slot_t *ent;
|
||||||
int (*fp)();
|
int (*fp) ();
|
||||||
long lbuf[3];
|
long lbuf[3];
|
||||||
|
|
||||||
if( !hdl || !(pobj->htab) || !sym || ! *sym )
|
if (!hdl || !(pobj->htab) || !sym || !*sym)
|
||||||
{
|
{
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return 0;
|
return 0;
|
||||||
@@ -450,9 +454,9 @@ void* dlsym(void* hdl, char* sym)
|
|||||||
errno = 0;
|
errno = 0;
|
||||||
errmsg = 0;
|
errmsg = 0;
|
||||||
|
|
||||||
ent = search( pobj->htab, sym );
|
ent = search (pobj->htab, sym);
|
||||||
|
|
||||||
if( ent )
|
if (ent)
|
||||||
return ent->fdesc;
|
return ent->fdesc;
|
||||||
|
|
||||||
#define n_name _n._n_name
|
#define n_name _n._n_name
|
||||||
@@ -474,10 +478,10 @@ void* dlsym(void* hdl, char* sym)
|
|||||||
* and SQLBrowseConnect() to force the driver manager
|
* and SQLBrowseConnect() to force the driver manager
|
||||||
* resolving all will be used symbols.
|
* resolving all will be used symbols.
|
||||||
*/
|
*/
|
||||||
if( nlist( pobj->path, nl) == -1 )
|
if (nlist (pobj->path, nl) == -1)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if( ! nl[0].n_type && ! nl[0].n_value )
|
if (!nl[0].n_type && !nl[0].n_value)
|
||||||
{
|
{
|
||||||
errmsg = "can't locate module entry symbol";
|
errmsg = "can't locate module entry symbol";
|
||||||
return 0;
|
return 0;
|
||||||
@@ -492,21 +496,21 @@ void* dlsym(void* hdl, char* sym)
|
|||||||
* both .n_type and .n_value would be 0.
|
* both .n_type and .n_value would be 0.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if( ! nl[1].n_type && ! nl[1].n_value )
|
if (!nl[1].n_type && !nl[1].n_value)
|
||||||
{
|
{
|
||||||
errmsg = "symbol not existance in this module";
|
errmsg = "symbol not existance in this module";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ent = slot_alloc(sym);
|
ent = slot_alloc (sym);
|
||||||
|
|
||||||
if( ! ent )
|
if (!ent)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* catch it with a slot in the hashing table */
|
/* catch it with a slot in the hashing table */
|
||||||
insert(pobj->htab, ent);
|
insert (pobj->htab, ent);
|
||||||
|
|
||||||
memcpy(ent->fdesc, pobj->pentry, sizeof(ent->fdesc));
|
memcpy (ent->fdesc, pobj->pentry, sizeof (ent->fdesc));
|
||||||
|
|
||||||
/* now ent->fdesc[0] is the virtual address of entry point
|
/* now ent->fdesc[0] is the virtual address of entry point
|
||||||
* and ent->fdesc[1] is the TOC of the module
|
* and ent->fdesc[1] is the TOC of the module
|
||||||
@@ -521,12 +525,11 @@ void* dlsym(void* hdl, char* sym)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
(ent->fdesc)[0] = (ent->fdesc)[0] +
|
(ent->fdesc)[0] = (ent->fdesc)[0] +
|
||||||
( nl[1].n_value - nl[0].n_value );
|
(nl[1].n_value - nl[0].n_value);
|
||||||
|
|
||||||
/* return the function descriptor */
|
/* return the function descriptor */
|
||||||
return ent->fdesc;
|
return ent->fdesc;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* end of IBM AIX Section */
|
#endif /* end of IBM AIX Section */
|
||||||
|
|
||||||
|
|
||||||
@@ -535,127 +538,75 @@ void* dlsym(void* hdl, char* sym)
|
|||||||
* Windows 3.x, 95, NT
|
* Windows 3.x, 95, NT
|
||||||
*
|
*
|
||||||
*********************************/
|
*********************************/
|
||||||
#ifdef DLDAPI_WINDOWS
|
|
||||||
# define DLDAPI_DEFINED
|
|
||||||
# include <windows.h>
|
|
||||||
|
|
||||||
void FAR* dlopen(char FAR* dll, int mode)
|
#ifdef DLDAPI_WINDOWS
|
||||||
|
#define DLDAPI_DEFINED
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
void FAR *
|
||||||
|
dlopen (char FAR * dll, int mode)
|
||||||
{
|
{
|
||||||
HINSTANCE hint;
|
HINSTANCE hint;
|
||||||
|
|
||||||
if( dll == NULL )
|
if (dll == NULL)
|
||||||
{
|
{
|
||||||
return GetWindowWord( NULL, GWW_HINSTANCE );
|
return GetWindowWord (NULL, GWW_HINSTANCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
hint = LoadLibrary(dll);
|
hint = LoadLibrary (dll);
|
||||||
|
|
||||||
if( hint < HINSTANCE_ERROR )
|
if (hint < HINSTANCE_ERROR)
|
||||||
{
|
{
|
||||||
return NULL;
|
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)
|
|
||||||
{
|
|
||||||
FreeLibrary((HINSTANCE)hdll);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
int
|
||||||
|
dlclose (void FAR * hdll)
|
||||||
|
{
|
||||||
|
FreeLibrary ((HINSTANCE) hdll);
|
||||||
|
}
|
||||||
#endif /* end of Windows family */
|
#endif /* end of Windows family */
|
||||||
|
|
||||||
/*********************************
|
|
||||||
*
|
|
||||||
* OS/2 2.x, 3.x
|
|
||||||
*
|
|
||||||
*********************************/
|
|
||||||
#ifdef DLDAPI_OS2
|
|
||||||
# define DLDAPI_DEFINED
|
|
||||||
/*
|
|
||||||
* 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
* other platforms
|
||||||
*
|
*
|
||||||
***********************************/
|
***********************************/
|
||||||
|
|
||||||
|
#ifdef DLDAPI_OS2
|
||||||
|
#define DLDAPI_DEFINED
|
||||||
|
/*
|
||||||
|
* DosLoadModule(), DosQueryProcAddress(), DosFreeModule(), ...
|
||||||
|
*/
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef DLDAPI_MAC
|
#ifdef DLDAPI_MAC
|
||||||
# define DLDAPI_DEFINED
|
#define DLDAPI_DEFINED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DLDAPI_NEXT
|
#ifdef DLDAPI_NEXT
|
||||||
# define DLDAPI_DEFINED
|
#define DLDAPI_DEFINED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DLDAPI_DEFINED
|
#ifndef DLDAPI_DEFINED
|
||||||
# error "dynamic load editor undefined"
|
#error "dynamic load editor undefined"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,24 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* dlf.h
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Dynamic Library Loader (mapping to SVR4)
|
||||||
|
*
|
||||||
|
* The iODBC driver manager.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free
|
||||||
|
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
#ifndef _DLF_H
|
#ifndef _DLF_H
|
||||||
# define _DLF_H
|
#define _DLF_H
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
#if defined(HAVE_LIBDL)
|
||||||
#define DLDAPI_SVR4_DLFCN
|
#define DLDAPI_SVR4_DLFCN
|
||||||
|
#elif defined(HAVE_SHL_LOAD)
|
||||||
# ifdef DLDAPI_SVR4_DLFCN
|
#define DLDAPI_HP_SHL
|
||||||
# include <dlfcn.h>
|
#endif
|
||||||
# else
|
|
||||||
extern void FAR* dlopen(char FAR* path, int mode);
|
#ifdef DLDAPI_SVR4_DLFCN
|
||||||
extern void FAR* dlsym(void FAR* hdll, char FAR* sym);
|
#include <dlfcn.h>
|
||||||
extern char FAR* dlerror();
|
#elif DLDAPI_AIX_LOAD
|
||||||
extern int dlclose(void FAR* hdll);
|
#include <dlfcn.h>
|
||||||
# endif
|
#else
|
||||||
|
extern void FAR *dlopen (char FAR * path, int mode);
|
||||||
# ifndef RTLD_LAZY
|
extern void FAR *dlsym (void FAR * hdll, char FAR * sym);
|
||||||
# define RTLD_LAZY 1
|
extern char FAR *dlerror ();
|
||||||
# endif
|
extern int dlclose (void FAR * hdll);
|
||||||
|
#endif
|
||||||
# define DLL_OPEN(dll) (void*)dlopen((char*)(path), RTLD_LAZY)
|
|
||||||
# define DLL_PROC(hdll, sym) (void*)dlsym((void*)(hdll), (char*)sym)
|
#ifndef RTLD_LAZY
|
||||||
# define DLL_ERROR() (char*)dlerror()
|
#define RTLD_LAZY 1
|
||||||
# define DLL_CLOSE(hdll) dlclose((void*)(hdll))
|
#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))
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,73 +1,84 @@
|
|||||||
/** Load driver and resolve driver's function entry point
|
/*
|
||||||
|
* dlproc.c
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Load driver and resolve driver's function entry point
|
||||||
|
*
|
||||||
|
* The iODBC driver manager.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free
|
||||||
|
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
#include <config.h>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
#include <isql.h>
|
||||||
it under the terms of the GNU General Public License as published by
|
#include <isqlext.h>
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
#include <dlproc.h>
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
**/
|
|
||||||
|
|
||||||
|
#include <herr.h>
|
||||||
|
#include <henv.h>
|
||||||
|
#include <hdbc.h>
|
||||||
|
|
||||||
#include <../iodbc/iodbc.h>
|
#include <itrace.h>
|
||||||
|
|
||||||
#include <../iodbc/isql.h>
|
#include "henv.ci"
|
||||||
#include <../iodbc/isqlext.h>
|
|
||||||
|
|
||||||
#include <../iodbc/dlproc.h>
|
HPROC
|
||||||
|
_iodbcdm_getproc (HDBC hdbc, int idx)
|
||||||
#include <../iodbc/herr.h>
|
|
||||||
#include <../iodbc/henv.h>
|
|
||||||
#include <../iodbc/hdbc.h>
|
|
||||||
|
|
||||||
#include <../iodbc/itrace.h>
|
|
||||||
|
|
||||||
#include "../iodbc/henv.ci"
|
|
||||||
|
|
||||||
HPROC _iodbcdm_getproc( HDBC hdbc, int idx )
|
|
||||||
{
|
{
|
||||||
DBC_t FAR* pdbc = (DBC_t FAR*)hdbc;
|
DBC_t FAR *pdbc = (DBC_t FAR *) hdbc;
|
||||||
ENV_t FAR* penv;
|
ENV_t FAR *penv;
|
||||||
HDLL hdll;
|
HDLL hdll;
|
||||||
static HPROC FAR* phproc;
|
HPROC FAR *phproc;
|
||||||
|
|
||||||
if( idx <= 0 || idx > SQL_EXT_API_LAST )
|
if (idx <= 0 || idx > SQL_EXT_API_LAST)
|
||||||
/* first entry never used */
|
/* first entry naver used */
|
||||||
{
|
{
|
||||||
return SQL_NULL_HPROC;
|
return SQL_NULL_HPROC;
|
||||||
}
|
}
|
||||||
|
|
||||||
penv = (ENV_t FAR*)(pdbc->henv);
|
penv = (ENV_t FAR *) (pdbc->henv);
|
||||||
|
|
||||||
if( penv == NULL )
|
if (penv == NULL)
|
||||||
{
|
{
|
||||||
return SQL_NULL_HPROC;
|
return SQL_NULL_HPROC;
|
||||||
}
|
}
|
||||||
|
|
||||||
phproc = penv->dllproc_tab + idx;
|
phproc = penv->dllproc_tab + idx;
|
||||||
|
|
||||||
if( *phproc == SQL_NULL_HPROC )
|
if (*phproc == SQL_NULL_HPROC)
|
||||||
{
|
{
|
||||||
int i, en_idx;
|
int i, en_idx;
|
||||||
|
|
||||||
for( i=0 ; ; i++ )
|
for (i = 0;; i++)
|
||||||
{
|
{
|
||||||
en_idx = odbcapi_symtab[i].en_idx;
|
en_idx = odbcapi_symtab[i].en_idx;
|
||||||
|
|
||||||
if( en_idx == en_NullProc )
|
if (en_idx == en_NullProc)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( en_idx == idx )
|
if (en_idx == idx)
|
||||||
{
|
{
|
||||||
*phproc = _iodbcdm_dllproc( penv->hdll,
|
*phproc = _iodbcdm_dllproc (penv->hdll,
|
||||||
odbcapi_symtab[i].symbol );
|
odbcapi_symtab[i].symbol);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -77,24 +88,33 @@ HPROC _iodbcdm_getproc( HDBC hdbc, int idx )
|
|||||||
return *phproc;
|
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 ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,39 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* dlproc.h
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Load driver and resolve driver's function entry point
|
||||||
|
*
|
||||||
|
* The iODBC driver manager.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free
|
||||||
|
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
#ifndef _DLPROC_H
|
#ifndef _DLPROC_H
|
||||||
# define _DLPROC_H
|
#define _DLPROC_H
|
||||||
|
|
||||||
# include <../iodbc/dlf.h>
|
#include <dlf.h>
|
||||||
|
|
||||||
# ifdef OS2
|
typedef RETCODE (FAR * HPROC) ();
|
||||||
typedef RETCODE (FAR* _System HPROC)();
|
|
||||||
# else
|
|
||||||
typedef RETCODE (FAR* HPROC)();
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# ifdef DLDAPI_SVR4_DLFCN
|
#ifdef DLDAPI_SVR4_DLFCN
|
||||||
# include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
typedef void* HDLL;
|
typedef void *HDLL;
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
# ifdef DLDAPI_HP_SHL
|
#ifdef DLDAPI_HP_SHL
|
||||||
# include <dl.h>
|
#include <dl.h>
|
||||||
typedef shl_t HDLL;
|
typedef shl_t HDLL;
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
# ifdef DLDAPI_AIX_LOAD
|
#ifdef DLDAPI_AIX_LOAD
|
||||||
typedef void* HDLL;
|
typedef void *HDLL;
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
# ifdef DLDAPI_OS2
|
extern HPROC _iodbcdm_getproc ();
|
||||||
typedef HMODULE HDLL;
|
extern HDLL _iodbcdm_dllopen (char FAR * dll);
|
||||||
# endif
|
extern HPROC _iodbcdm_dllproc (HDLL hdll, char FAR * sym);
|
||||||
|
extern char FAR *_iodbcdm_dllerror ();
|
||||||
extern HPROC _iodbcdm_getproc();
|
extern int _iodbcdm_dllclose (HDLL hdll);
|
||||||
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_HDLL ((HDLL)NULL)
|
||||||
#define SQL_NULL_HPROC ((HPROC)NULL)
|
#define SQL_NULL_HPROC ((HPROC)NULL)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,45 +1,56 @@
|
|||||||
/** Invoke a query
|
/*
|
||||||
|
* execute.c
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Invoke a query
|
||||||
|
*
|
||||||
|
* The iODBC driver manager.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free
|
||||||
|
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
#include <config.h>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
#include <isql.h>
|
||||||
it under the terms of the GNU General Public License as published by
|
#include <isqlext.h>
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
#include <dlproc.h>
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
**/
|
|
||||||
|
|
||||||
#include <../iodbc/iodbc.h>
|
#include <herr.h>
|
||||||
|
#include <henv.h>
|
||||||
|
#include <hdbc.h>
|
||||||
|
#include <hstmt.h>
|
||||||
|
|
||||||
#include <../iodbc/isql.h>
|
#include <itrace.h>
|
||||||
#include <../iodbc/isqlext.h>
|
|
||||||
|
|
||||||
#include <../iodbc/dlproc.h>
|
static void
|
||||||
|
do_cursoropen (STMT_t FAR * pstmt)
|
||||||
#include <../iodbc/herr.h>
|
|
||||||
#include <../iodbc/henv.h>
|
|
||||||
#include <../iodbc/hdbc.h>
|
|
||||||
#include <../iodbc/hstmt.h>
|
|
||||||
|
|
||||||
#include <../iodbc/itrace.h>
|
|
||||||
|
|
||||||
static void do_cursoropen(STMT_t FAR* pstmt)
|
|
||||||
{
|
{
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
SWORD ncol;
|
SWORD ncol;
|
||||||
|
|
||||||
pstmt->state = en_stmt_executed;
|
pstmt->state = en_stmt_executed;
|
||||||
|
|
||||||
retcode = SQLNumResultCols( pstmt, &ncol );
|
retcode = SQLNumResultCols (pstmt, &ncol);
|
||||||
|
|
||||||
if( retcode == SQL_SUCCESS
|
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
|
||||||
|| retcode == SQL_SUCCESS_WITH_INFO )
|
|
||||||
{
|
{
|
||||||
if( ncol )
|
if (ncol)
|
||||||
{
|
{
|
||||||
pstmt->state = en_stmt_cursoropen;
|
pstmt->state = en_stmt_cursoropen;
|
||||||
pstmt->cursor_state = en_stmt_cursor_opened;
|
pstmt->cursor_state = en_stmt_cursor_opened;
|
||||||
@@ -52,38 +63,39 @@ static void do_cursoropen(STMT_t FAR* pstmt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RETCODE SQL_API SQLExecute ( HSTMT hstmt )
|
|
||||||
|
RETCODE SQL_API
|
||||||
|
SQLExecute (HSTMT hstmt)
|
||||||
{
|
{
|
||||||
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
STMT_t FAR *pstmt = (STMT_t FAR *) hstmt;
|
||||||
HPROC hproc = SQL_NULL_HPROC;
|
HPROC hproc = SQL_NULL_HPROC;
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
|
|
||||||
int sqlstat = en_00000;
|
int sqlstat = en_00000;
|
||||||
|
|
||||||
if( hstmt == SQL_NULL_HSTMT
|
if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC)
|
||||||
|| pstmt->hdbc == SQL_NULL_HDBC )
|
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check state */
|
/* check state */
|
||||||
if( pstmt->asyn_on == en_NullProc )
|
if (pstmt->asyn_on == en_NullProc)
|
||||||
{
|
{
|
||||||
switch( pstmt->state )
|
switch (pstmt->state)
|
||||||
{
|
{
|
||||||
case en_stmt_allocated:
|
case en_stmt_allocated:
|
||||||
sqlstat = en_S1010;
|
sqlstat = en_S1010;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case en_stmt_executed:
|
case en_stmt_executed:
|
||||||
if( ! pstmt->prep_state )
|
if (!pstmt->prep_state)
|
||||||
{
|
{
|
||||||
sqlstat = en_S1010;
|
sqlstat = en_S1010;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case en_stmt_cursoropen:
|
case en_stmt_cursoropen:
|
||||||
if( ! pstmt->prep_state )
|
if (!pstmt->prep_state)
|
||||||
{
|
{
|
||||||
sqlstat = en_S1010;
|
sqlstat = en_S1010;
|
||||||
}
|
}
|
||||||
@@ -91,7 +103,7 @@ RETCODE SQL_API SQLExecute ( HSTMT hstmt )
|
|||||||
|
|
||||||
case en_stmt_fetched:
|
case en_stmt_fetched:
|
||||||
case en_stmt_xfetched:
|
case en_stmt_xfetched:
|
||||||
if( ! pstmt->prep_state )
|
if (!pstmt->prep_state)
|
||||||
{
|
{
|
||||||
sqlstat = en_S1010;
|
sqlstat = en_S1010;
|
||||||
}
|
}
|
||||||
@@ -111,39 +123,35 @@ RETCODE SQL_API SQLExecute ( HSTMT hstmt )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( pstmt->asyn_on != en_Execute )
|
else if (pstmt->asyn_on != en_Execute)
|
||||||
{
|
{
|
||||||
sqlstat = en_S1010;
|
sqlstat = en_S1010;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( sqlstat == en_00000 )
|
if (sqlstat == en_00000)
|
||||||
{
|
{
|
||||||
hproc = _iodbcdm_getproc( pstmt->hdbc, en_Execute );
|
hproc = _iodbcdm_getproc (pstmt->hdbc, en_Execute);
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
if (hproc == SQL_NULL_HPROC)
|
||||||
{
|
{
|
||||||
sqlstat = en_IM001;
|
sqlstat = en_IM001;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( sqlstat != en_00000 )
|
if (sqlstat != en_00000)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, sqlstat );
|
PUSHSQLERR (pstmt->herr, sqlstat);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
CALL_DRIVER ( pstmt->hdbc, retcode, hproc,
|
CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_Execute,
|
||||||
en_Execute, ( pstmt->dhstmt ) )
|
(pstmt->dhstmt))
|
||||||
|
|
||||||
#if 0
|
|
||||||
retcode = hproc ( pstmt->dhstmt );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* stmt state transition */
|
/* stmt state transition */
|
||||||
if( pstmt->asyn_on == en_Execute )
|
if (pstmt->asyn_on == en_Execute)
|
||||||
{
|
{
|
||||||
switch ( retcode )
|
switch (retcode)
|
||||||
{
|
{
|
||||||
case SQL_SUCCESS:
|
case SQL_SUCCESS:
|
||||||
case SQL_SUCCESS_WITH_INFO:
|
case SQL_SUCCESS_WITH_INFO:
|
||||||
@@ -158,14 +166,14 @@ RETCODE SQL_API SQLExecute ( HSTMT hstmt )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( pstmt->state )
|
switch (pstmt->state)
|
||||||
{
|
{
|
||||||
case en_stmt_prepared:
|
case en_stmt_prepared:
|
||||||
switch( retcode )
|
switch (retcode)
|
||||||
{
|
{
|
||||||
case SQL_SUCCESS:
|
case SQL_SUCCESS:
|
||||||
case SQL_SUCCESS_WITH_INFO:
|
case SQL_SUCCESS_WITH_INFO:
|
||||||
do_cursoropen(hstmt);
|
do_cursoropen (hstmt);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SQL_NEED_DATA:
|
case SQL_NEED_DATA:
|
||||||
@@ -183,7 +191,7 @@ RETCODE SQL_API SQLExecute ( HSTMT hstmt )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case en_stmt_executed:
|
case en_stmt_executed:
|
||||||
switch( retcode )
|
switch (retcode)
|
||||||
{
|
{
|
||||||
case SQL_ERROR:
|
case SQL_ERROR:
|
||||||
pstmt->state = en_stmt_allocated;
|
pstmt->state = en_stmt_allocated;
|
||||||
@@ -212,44 +220,45 @@ RETCODE SQL_API SQLExecute ( HSTMT hstmt )
|
|||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETCODE SQL_API SQLExecDirect (
|
|
||||||
|
RETCODE SQL_API
|
||||||
|
SQLExecDirect (
|
||||||
HSTMT hstmt,
|
HSTMT hstmt,
|
||||||
UCHAR FAR* szSqlStr,
|
UCHAR FAR * szSqlStr,
|
||||||
SDWORD cbSqlStr )
|
SDWORD cbSqlStr)
|
||||||
{
|
{
|
||||||
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
STMT_t FAR *pstmt = (STMT_t FAR *) hstmt;
|
||||||
HPROC hproc = SQL_NULL_HPROC;
|
HPROC hproc = SQL_NULL_HPROC;
|
||||||
|
|
||||||
int sqlstat = en_00000;
|
int sqlstat = en_00000;
|
||||||
RETCODE retcode = SQL_SUCCESS;
|
RETCODE retcode = SQL_SUCCESS;
|
||||||
|
|
||||||
if( hstmt == SQL_NULL_HSTMT
|
if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC)
|
||||||
|| pstmt->hdbc == SQL_NULL_HDBC )
|
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check arguments */
|
/* check arguments */
|
||||||
if( szSqlStr == NULL )
|
if (szSqlStr == NULL)
|
||||||
{
|
{
|
||||||
sqlstat = en_S1009;
|
sqlstat = en_S1009;
|
||||||
}
|
}
|
||||||
else if( cbSqlStr < 0 && cbSqlStr != SQL_NTS )
|
else if (cbSqlStr < 0 && cbSqlStr != SQL_NTS)
|
||||||
{
|
{
|
||||||
sqlstat = en_S1090;
|
sqlstat = en_S1090;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( sqlstat != en_00000 )
|
if (sqlstat != en_00000)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, sqlstat );
|
PUSHSQLERR (pstmt->herr, sqlstat);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check state */
|
/* check state */
|
||||||
if( pstmt->asyn_on == en_NullProc )
|
if (pstmt->asyn_on == en_NullProc)
|
||||||
{
|
{
|
||||||
switch ( pstmt->state )
|
switch (pstmt->state)
|
||||||
{
|
{
|
||||||
case en_stmt_fetched:
|
case en_stmt_fetched:
|
||||||
case en_stmt_xfetched:
|
case en_stmt_xfetched:
|
||||||
@@ -266,39 +275,34 @@ RETCODE SQL_API SQLExecDirect (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( pstmt->asyn_on != en_ExecDirect )
|
else if (pstmt->asyn_on != en_ExecDirect)
|
||||||
{
|
{
|
||||||
sqlstat = en_S1010;
|
sqlstat = en_S1010;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( sqlstat != en_00000 )
|
if (sqlstat != en_00000)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, sqlstat );
|
PUSHSQLERR (pstmt->herr, sqlstat);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
hproc = _iodbcdm_getproc( pstmt->hdbc, en_ExecDirect);
|
hproc = _iodbcdm_getproc (pstmt->hdbc, en_ExecDirect);
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
if (hproc == SQL_NULL_HPROC)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
PUSHSQLERR (pstmt->herr, en_IM001);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_ExecDirect, (
|
CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_ExecDirect,
|
||||||
pstmt->dhstmt, szSqlStr, cbSqlStr) )
|
(pstmt->dhstmt, szSqlStr, cbSqlStr))
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
retcode = hproc ( pstmt->dhstmt, szSqlStr, cbSqlStr );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* stmt state transition */
|
/* stmt state transition */
|
||||||
if( pstmt->asyn_on == en_ExecDirect )
|
if (pstmt->asyn_on == en_ExecDirect)
|
||||||
{
|
{
|
||||||
switch ( retcode )
|
switch (retcode)
|
||||||
{
|
{
|
||||||
case SQL_SUCCESS:
|
case SQL_SUCCESS:
|
||||||
case SQL_SUCCESS_WITH_INFO:
|
case SQL_SUCCESS_WITH_INFO:
|
||||||
@@ -313,13 +317,13 @@ RETCODE SQL_API SQLExecDirect (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pstmt->state <= en_stmt_executed )
|
if (pstmt->state <= en_stmt_executed)
|
||||||
{
|
{
|
||||||
switch( retcode )
|
switch (retcode)
|
||||||
{
|
{
|
||||||
case SQL_SUCCESS:
|
case SQL_SUCCESS:
|
||||||
case SQL_SUCCESS_WITH_INFO:
|
case SQL_SUCCESS_WITH_INFO:
|
||||||
do_cursoropen(hstmt);
|
do_cursoropen (hstmt);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SQL_NEED_DATA:
|
case SQL_NEED_DATA:
|
||||||
@@ -345,69 +349,65 @@ RETCODE SQL_API SQLExecDirect (
|
|||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETCODE SQL_API SQLPutData(
|
|
||||||
|
RETCODE SQL_API
|
||||||
|
SQLPutData (
|
||||||
HSTMT hstmt,
|
HSTMT hstmt,
|
||||||
PTR rgbValue,
|
PTR rgbValue,
|
||||||
SDWORD cbValue )
|
SDWORD cbValue)
|
||||||
{
|
{
|
||||||
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
STMT_t FAR *pstmt = (STMT_t FAR *) hstmt;
|
||||||
HPROC hproc;
|
HPROC hproc;
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
|
|
||||||
if( hstmt == SQL_NULL_HSTMT
|
if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC)
|
||||||
|| pstmt->hdbc == SQL_NULL_HDBC )
|
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check argument value */
|
/* check argument value */
|
||||||
if( rgbValue == NULL
|
if (rgbValue == NULL &&
|
||||||
&& ( cbValue != SQL_DEFAULT_PARAM
|
(cbValue != SQL_DEFAULT_PARAM && cbValue != SQL_NULL_DATA))
|
||||||
&& cbValue != SQL_NULL_DATA ) )
|
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1009 );
|
PUSHSQLERR (pstmt->herr, en_S1009);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check state */
|
/* check state */
|
||||||
if( pstmt->asyn_on == en_NullProc )
|
if (pstmt->asyn_on == en_NullProc)
|
||||||
{
|
{
|
||||||
if( pstmt->state <= en_stmt_xfetched )
|
if (pstmt->state <= en_stmt_xfetched)
|
||||||
{
|
{
|
||||||
PUSHSQLERR( pstmt->herr, en_S1010 );
|
PUSHSQLERR (pstmt->herr, en_S1010);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( pstmt->asyn_on != en_PutData )
|
else if (pstmt->asyn_on != en_PutData)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1010 );
|
PUSHSQLERR (pstmt->herr, en_S1010);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* call driver */
|
/* call driver */
|
||||||
hproc = _iodbcdm_getproc( pstmt->hdbc, en_PutData );
|
hproc = _iodbcdm_getproc (pstmt->hdbc, en_PutData);
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
if (hproc == SQL_NULL_HPROC)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
PUSHSQLERR (pstmt->herr, en_IM001);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_PutData, (
|
CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_PutData,
|
||||||
pstmt->dhstmt, rgbValue, cbValue ) )
|
(pstmt->dhstmt, rgbValue, cbValue))
|
||||||
|
|
||||||
#if 0
|
|
||||||
retcode = hproc(pstmt->dhstmt, rgbValue, cbValue );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* state transition */
|
/* state transition */
|
||||||
if( pstmt->asyn_on == en_PutData )
|
if (pstmt->asyn_on == en_PutData)
|
||||||
{
|
{
|
||||||
switch( retcode )
|
switch (retcode)
|
||||||
{
|
{
|
||||||
case SQL_SUCCESS:
|
case SQL_SUCCESS:
|
||||||
case SQL_SUCCESS_WITH_INFO:
|
case SQL_SUCCESS_WITH_INFO:
|
||||||
@@ -422,7 +422,7 @@ RETCODE SQL_API SQLPutData(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* must in mustput or canput states */
|
/* must in mustput or canput states */
|
||||||
switch( retcode )
|
switch (retcode)
|
||||||
{
|
{
|
||||||
case SQL_SUCCESS:
|
case SQL_SUCCESS:
|
||||||
case SQL_SUCCESS_WITH_INFO:
|
case SQL_SUCCESS_WITH_INFO:
|
||||||
@@ -430,7 +430,7 @@ RETCODE SQL_API SQLPutData(
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SQL_ERROR:
|
case SQL_ERROR:
|
||||||
switch( pstmt->need_on )
|
switch (pstmt->need_on)
|
||||||
{
|
{
|
||||||
case en_ExecDirect:
|
case en_ExecDirect:
|
||||||
pstmt->state = en_stmt_allocated;
|
pstmt->state = en_stmt_allocated;
|
||||||
@@ -438,7 +438,7 @@ RETCODE SQL_API SQLPutData(
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case en_Execute:
|
case en_Execute:
|
||||||
if( pstmt->prep_state )
|
if (pstmt->prep_state)
|
||||||
{
|
{
|
||||||
pstmt->state = en_stmt_prepared;
|
pstmt->state = en_stmt_prepared;
|
||||||
pstmt->need_on = en_NullProc;
|
pstmt->need_on = en_NullProc;
|
||||||
@@ -466,16 +466,17 @@ RETCODE SQL_API SQLPutData(
|
|||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETCODE SQL_API SQLParamData (
|
|
||||||
|
RETCODE SQL_API
|
||||||
|
SQLParamData (
|
||||||
HSTMT hstmt,
|
HSTMT hstmt,
|
||||||
PTR FAR* prgbValue )
|
PTR FAR * prgbValue)
|
||||||
{
|
{
|
||||||
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
STMT_t FAR *pstmt = (STMT_t FAR *) hstmt;
|
||||||
HPROC hproc;
|
HPROC hproc;
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
|
|
||||||
if( hstmt == SQL_NULL_HSTMT
|
if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC)
|
||||||
|| pstmt->hdbc == SQL_NULL_HDBC )
|
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
@@ -483,43 +484,39 @@ RETCODE SQL_API SQLParamData (
|
|||||||
/* check argument */
|
/* check argument */
|
||||||
|
|
||||||
/* check state */
|
/* check state */
|
||||||
if( pstmt->asyn_on == en_NullProc )
|
if (pstmt->asyn_on == en_NullProc)
|
||||||
{
|
{
|
||||||
if( pstmt->state <= en_stmt_xfetched )
|
if (pstmt->state <= en_stmt_xfetched)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1010 );
|
PUSHSQLERR (pstmt->herr, en_S1010);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( pstmt->asyn_on != en_ParamData )
|
else if (pstmt->asyn_on != en_ParamData)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1010 );
|
PUSHSQLERR (pstmt->herr, en_S1010);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* call driver */
|
/* call driver */
|
||||||
hproc = _iodbcdm_getproc( pstmt->hdbc, en_ParamData );
|
hproc = _iodbcdm_getproc (pstmt->hdbc, en_ParamData);
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
if (hproc == SQL_NULL_HPROC)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
PUSHSQLERR (pstmt->herr, en_IM001);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_ParamData, (
|
CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_ParamData,
|
||||||
pstmt->dhstmt, prgbValue ) )
|
(pstmt->dhstmt, prgbValue))
|
||||||
|
|
||||||
#if 0
|
|
||||||
retcode = hproc ( pstmt->dhstmt, prgbValue );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* state transition */
|
/* state transition */
|
||||||
if( pstmt->asyn_on == en_ParamData )
|
if (pstmt->asyn_on == en_ParamData)
|
||||||
{
|
{
|
||||||
switch( retcode )
|
switch (retcode)
|
||||||
{
|
{
|
||||||
case SQL_SUCCESS:
|
case SQL_SUCCESS:
|
||||||
case SQL_SUCCESS_WITH_INFO:
|
case SQL_SUCCESS_WITH_INFO:
|
||||||
@@ -533,15 +530,15 @@ RETCODE SQL_API SQLParamData (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pstmt->state < en_stmt_needdata )
|
if (pstmt->state < en_stmt_needdata)
|
||||||
{
|
{
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( retcode )
|
switch (retcode)
|
||||||
{
|
{
|
||||||
case SQL_ERROR:
|
case SQL_ERROR:
|
||||||
switch( pstmt->need_on )
|
switch (pstmt->need_on)
|
||||||
{
|
{
|
||||||
case en_ExecDirect:
|
case en_ExecDirect:
|
||||||
pstmt->state = en_stmt_allocated;
|
pstmt->state = en_stmt_allocated;
|
||||||
@@ -565,14 +562,14 @@ RETCODE SQL_API SQLParamData (
|
|||||||
|
|
||||||
case SQL_SUCCESS:
|
case SQL_SUCCESS:
|
||||||
case SQL_SUCCESS_WITH_INFO:
|
case SQL_SUCCESS_WITH_INFO:
|
||||||
switch( pstmt->state )
|
switch (pstmt->state)
|
||||||
{
|
{
|
||||||
case en_stmt_needdata:
|
case en_stmt_needdata:
|
||||||
pstmt->state = en_stmt_mustput;
|
pstmt->state = en_stmt_mustput;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case en_stmt_canput:
|
case en_stmt_canput:
|
||||||
switch( pstmt->need_on )
|
switch (pstmt->need_on)
|
||||||
{
|
{
|
||||||
case en_SetPos:
|
case en_SetPos:
|
||||||
pstmt->state
|
pstmt->state
|
||||||
@@ -583,7 +580,7 @@ RETCODE SQL_API SQLParamData (
|
|||||||
|
|
||||||
case en_ExecDirect:
|
case en_ExecDirect:
|
||||||
case en_Execute:
|
case en_Execute:
|
||||||
do_cursoropen(hstmt);
|
do_cursoropen (hstmt);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -609,16 +606,16 @@ RETCODE SQL_API SQLParamData (
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
RETCODE SQL_API SQLNumParams (
|
RETCODE SQL_API
|
||||||
|
SQLNumParams (
|
||||||
HSTMT hstmt,
|
HSTMT hstmt,
|
||||||
SWORD FAR* pcpar )
|
SWORD FAR * pcpar)
|
||||||
{
|
{
|
||||||
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
STMT_t FAR *pstmt = (STMT_t FAR *) hstmt;
|
||||||
HPROC hproc;
|
HPROC hproc;
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
|
|
||||||
if( hstmt == SQL_NULL_HSTMT
|
if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC)
|
||||||
|| pstmt->hdbc == SQL_NULL_HDBC )
|
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
@@ -626,50 +623,45 @@ RETCODE SQL_API SQLNumParams (
|
|||||||
/* check argument */
|
/* check argument */
|
||||||
|
|
||||||
/* check state */
|
/* check state */
|
||||||
if( pstmt->asyn_on == en_NullProc )
|
if (pstmt->asyn_on == en_NullProc)
|
||||||
{
|
{
|
||||||
switch( pstmt->state )
|
switch (pstmt->state)
|
||||||
{
|
{
|
||||||
case en_stmt_allocated:
|
case en_stmt_allocated:
|
||||||
case en_stmt_needdata:
|
case en_stmt_needdata:
|
||||||
case en_stmt_mustput:
|
case en_stmt_mustput:
|
||||||
case en_stmt_canput:
|
case en_stmt_canput:
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1010 );
|
PUSHSQLERR (pstmt->herr, en_S1010);
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( pstmt->asyn_on != en_NumParams )
|
else if (pstmt->asyn_on != en_NumParams)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1010 );
|
PUSHSQLERR (pstmt->herr, en_S1010);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* call driver */
|
/* call driver */
|
||||||
hproc = _iodbcdm_getproc ( pstmt->hdbc, en_NumParams );
|
hproc = _iodbcdm_getproc (pstmt->hdbc, en_NumParams);
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
if (hproc == SQL_NULL_HPROC)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
PUSHSQLERR (pstmt->herr, en_IM001);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_NumParams, (
|
CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_NumParams,
|
||||||
pstmt->dhstmt, pcpar) )
|
(pstmt->dhstmt, pcpar))
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
retcode = hproc ( pstmt->dhstmt, pcpar );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* state transition */
|
/* state transition */
|
||||||
if( pstmt->asyn_on == en_NumParams )
|
if (pstmt->asyn_on == en_NumParams)
|
||||||
{
|
{
|
||||||
switch ( retcode )
|
switch (retcode)
|
||||||
{
|
{
|
||||||
case SQL_SUCCESS:
|
case SQL_SUCCESS:
|
||||||
case SQL_SUCCESS_WITH_INFO:
|
case SQL_SUCCESS_WITH_INFO:
|
||||||
@@ -681,7 +673,7 @@ RETCODE SQL_API SQLNumParams (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( retcode == SQL_STILL_EXECUTING )
|
if (retcode == SQL_STILL_EXECUTING)
|
||||||
{
|
{
|
||||||
pstmt->asyn_on = en_NumParams;
|
pstmt->asyn_on = en_NumParams;
|
||||||
}
|
}
|
||||||
@@ -689,86 +681,73 @@ RETCODE SQL_API SQLNumParams (
|
|||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETCODE SQL_API SQLDescribeParam (
|
|
||||||
|
RETCODE SQL_API
|
||||||
|
SQLDescribeParam (
|
||||||
HSTMT hstmt,
|
HSTMT hstmt,
|
||||||
UWORD ipar,
|
UWORD ipar,
|
||||||
SWORD FAR* pfSqlType,
|
SWORD FAR * pfSqlType,
|
||||||
UDWORD FAR* pcbColDef,
|
UDWORD FAR * pcbColDef,
|
||||||
SWORD FAR* pibScale,
|
SWORD FAR * pibScale,
|
||||||
SWORD FAR* pfNullable )
|
SWORD FAR * pfNullable)
|
||||||
{
|
{
|
||||||
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
STMT_t FAR *pstmt = (STMT_t FAR *) hstmt;
|
||||||
HPROC hproc;
|
HPROC hproc;
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
|
|
||||||
if( hstmt == SQL_NULL_HSTMT
|
if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC)
|
||||||
|| pstmt->hdbc == SQL_NULL_HDBC )
|
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check argument */
|
/* check argument */
|
||||||
if( ipar == 0 )
|
if (ipar == 0)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1093 );
|
PUSHSQLERR (pstmt->herr, en_S1093);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check state */
|
/* check state */
|
||||||
if( pstmt->asyn_on == en_NullProc )
|
if (pstmt->asyn_on == en_NullProc)
|
||||||
{
|
{
|
||||||
switch( pstmt->state )
|
switch (pstmt->state)
|
||||||
{
|
{
|
||||||
case en_stmt_allocated:
|
case en_stmt_allocated:
|
||||||
case en_stmt_needdata:
|
case en_stmt_needdata:
|
||||||
case en_stmt_mustput:
|
case en_stmt_mustput:
|
||||||
case en_stmt_canput:
|
case en_stmt_canput:
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1010 );
|
PUSHSQLERR (pstmt->herr, en_S1010);
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( pstmt->asyn_on != en_DescribeParam )
|
else if (pstmt->asyn_on != en_DescribeParam)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1010 );
|
PUSHSQLERR (pstmt->herr, en_S1010);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* call driver */
|
/* call driver */
|
||||||
hproc = _iodbcdm_getproc ( pstmt->hdbc, en_DescribeParam );
|
hproc = _iodbcdm_getproc (pstmt->hdbc, en_DescribeParam);
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
if (hproc == SQL_NULL_HPROC)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
PUSHSQLERR (pstmt->herr, en_IM001);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_DescribeParam, (
|
CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_DescribeParam,
|
||||||
pstmt->dhstmt,
|
(pstmt->dhstmt, ipar, pfSqlType, pcbColDef, pibScale, pfNullable))
|
||||||
ipar,
|
|
||||||
pfSqlType,
|
|
||||||
pcbColDef,
|
|
||||||
pibScale,
|
|
||||||
pfNullable ) )
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
retcode = hproc(pstmt->dhstmt,
|
|
||||||
ipar,
|
|
||||||
pfSqlType,
|
|
||||||
pcbColDef,
|
|
||||||
pibScale,
|
|
||||||
pfNullable );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* state transition */
|
/* state transition */
|
||||||
if( pstmt->asyn_on == en_DescribeParam )
|
if (pstmt->asyn_on == en_DescribeParam)
|
||||||
{
|
{
|
||||||
switch ( retcode )
|
switch (retcode)
|
||||||
{
|
{
|
||||||
case SQL_SUCCESS:
|
case SQL_SUCCESS:
|
||||||
case SQL_SUCCESS_WITH_INFO:
|
case SQL_SUCCESS_WITH_INFO:
|
||||||
@@ -780,7 +759,7 @@ RETCODE SQL_API SQLDescribeParam (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( retcode == SQL_STILL_EXECUTING )
|
if (retcode == SQL_STILL_EXECUTING)
|
||||||
{
|
{
|
||||||
pstmt->asyn_on = en_DescribeParam;
|
pstmt->asyn_on = en_DescribeParam;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,28 @@
|
|||||||
/** Fetch query result
|
/*
|
||||||
|
* fetch.c
|
||||||
Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
*
|
||||||
|
* $Id$
|
||||||
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
|
* Fetch query result
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
*
|
||||||
(at your option) any later version.
|
* The iODBC driver manager.
|
||||||
|
*
|
||||||
This program is distributed in the hope that it will be useful,
|
* Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
*
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* This library is free software; you can redistribute it and/or
|
||||||
GNU General Public License for more details.
|
* modify it under the terms of the GNU Library General Public
|
||||||
**/
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free
|
||||||
|
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
@@ -27,22 +38,22 @@
|
|||||||
|
|
||||||
#include <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;
|
STMT_t FAR *pstmt = (STMT_t FAR *) hstmt;
|
||||||
HPROC hproc = SQL_NULL_HPROC;
|
HPROC hproc = SQL_NULL_HPROC;
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
|
|
||||||
if( hstmt == SQL_NULL_HSTMT
|
if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC)
|
||||||
|| pstmt->hdbc == SQL_NULL_HDBC )
|
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check state */
|
/* check state */
|
||||||
if( pstmt->asyn_on == en_NullProc )
|
if (pstmt->asyn_on == en_NullProc)
|
||||||
{
|
{
|
||||||
switch( pstmt->state )
|
switch (pstmt->state)
|
||||||
{
|
{
|
||||||
case en_stmt_allocated:
|
case en_stmt_allocated:
|
||||||
case en_stmt_prepared:
|
case en_stmt_prepared:
|
||||||
@@ -50,37 +61,35 @@ RETCODE SQL_API SQLFetch ( HSTMT hstmt )
|
|||||||
case en_stmt_needdata:
|
case en_stmt_needdata:
|
||||||
case en_stmt_mustput:
|
case en_stmt_mustput:
|
||||||
case en_stmt_canput:
|
case en_stmt_canput:
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1010 );
|
PUSHSQLERR (pstmt->herr, en_S1010);
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( pstmt->asyn_on != en_Fetch )
|
else if (pstmt->asyn_on != en_Fetch)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1010 );
|
PUSHSQLERR (pstmt->herr, en_S1010);
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
hproc = _iodbcdm_getproc( pstmt->hdbc, en_Fetch );
|
hproc = _iodbcdm_getproc (pstmt->hdbc, en_Fetch);
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
if (hproc == SQL_NULL_HPROC)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
PUSHSQLERR (pstmt->herr, en_IM001);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_Fetch, (pstmt->dhstmt) )
|
CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_Fetch,
|
||||||
|
(pstmt->dhstmt))
|
||||||
|
|
||||||
#if 0
|
|
||||||
retcode = hproc( pstmt->dhstmt );
|
|
||||||
#endif
|
|
||||||
/* state transition */
|
/* state transition */
|
||||||
if( pstmt->asyn_on == en_Fetch )
|
if (pstmt->asyn_on == en_Fetch)
|
||||||
{
|
{
|
||||||
switch( retcode )
|
switch (retcode)
|
||||||
{
|
{
|
||||||
case SQL_SUCCESS:
|
case SQL_SUCCESS:
|
||||||
case SQL_SUCCESS_WITH_INFO:
|
case SQL_SUCCESS_WITH_INFO:
|
||||||
@@ -95,11 +104,11 @@ RETCODE SQL_API SQLFetch ( HSTMT hstmt )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( pstmt->state )
|
switch (pstmt->state)
|
||||||
{
|
{
|
||||||
case en_stmt_cursoropen:
|
case en_stmt_cursoropen:
|
||||||
case en_stmt_fetched:
|
case en_stmt_fetched:
|
||||||
switch( retcode )
|
switch (retcode)
|
||||||
{
|
{
|
||||||
case SQL_SUCCESS:
|
case SQL_SUCCESS:
|
||||||
case SQL_SUCCESS_WITH_INFO:
|
case SQL_SUCCESS_WITH_INFO:
|
||||||
@@ -108,7 +117,7 @@ RETCODE SQL_API SQLFetch ( HSTMT hstmt )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SQL_NO_DATA_FOUND:
|
case SQL_NO_DATA_FOUND:
|
||||||
if( pstmt->prep_state )
|
if (pstmt->prep_state)
|
||||||
{
|
{
|
||||||
pstmt->state = en_stmt_prepared;
|
pstmt->state = en_stmt_prepared;
|
||||||
}
|
}
|
||||||
@@ -136,41 +145,41 @@ RETCODE SQL_API SQLFetch ( HSTMT hstmt )
|
|||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETCODE SQL_API SQLExtendedFetch (
|
|
||||||
|
RETCODE SQL_API
|
||||||
|
SQLExtendedFetch (
|
||||||
HSTMT hstmt,
|
HSTMT hstmt,
|
||||||
UWORD fFetchType,
|
UWORD fFetchType,
|
||||||
SDWORD irow,
|
SDWORD irow,
|
||||||
UDWORD FAR* pcrow,
|
UDWORD FAR * pcrow,
|
||||||
UWORD FAR* rgfRowStatus )
|
UWORD FAR * rgfRowStatus)
|
||||||
{
|
{
|
||||||
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
STMT_t FAR *pstmt = (STMT_t FAR *) hstmt;
|
||||||
HPROC hproc = SQL_NULL_HPROC;
|
HPROC hproc = SQL_NULL_HPROC;
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
|
|
||||||
if( hstmt == SQL_NULL_HSTMT
|
if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC)
|
||||||
|| pstmt->hdbc == SQL_NULL_HDBC )
|
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check fetch type */
|
/* check fetch type */
|
||||||
if( fFetchType < SQL_FETCH_NEXT
|
if (fFetchType < SQL_FETCH_NEXT || fFetchType > SQL_FETCH_BOOKMARK)
|
||||||
|| fFetchType > SQL_FETCH_BOOKMARK )
|
|
||||||
{
|
{
|
||||||
/* Unlike MS driver manager(i.e. DM),
|
/* Unlike MS driver manager(i.e. DM),
|
||||||
* we don't check driver's ODBC version
|
* we don't check driver's ODBC version
|
||||||
* against SQL_FETCH_RESUME (only 1.0)
|
* against SQL_FETCH_RESUME (only 1.0)
|
||||||
* and SQL_FETCH_BOOKMARK (only 2.0).
|
* and SQL_FETCH_BOOKMARK (only 2.0).
|
||||||
*/
|
*/
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1106 );
|
PUSHSQLERR (pstmt->herr, en_S1106);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check state */
|
/* check state */
|
||||||
if( pstmt->asyn_on == en_NullProc )
|
if (pstmt->asyn_on == en_NullProc)
|
||||||
{
|
{
|
||||||
switch( pstmt->state )
|
switch (pstmt->state)
|
||||||
{
|
{
|
||||||
case en_stmt_allocated:
|
case en_stmt_allocated:
|
||||||
case en_stmt_prepared:
|
case en_stmt_prepared:
|
||||||
@@ -178,47 +187,35 @@ RETCODE SQL_API SQLExtendedFetch (
|
|||||||
case en_stmt_needdata:
|
case en_stmt_needdata:
|
||||||
case en_stmt_mustput:
|
case en_stmt_mustput:
|
||||||
case en_stmt_canput:
|
case en_stmt_canput:
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1010 );
|
PUSHSQLERR (pstmt->herr, en_S1010);
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( pstmt->asyn_on != en_ExtendedFetch )
|
else if (pstmt->asyn_on != en_ExtendedFetch)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1010 );
|
PUSHSQLERR (pstmt->herr, en_S1010);
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
hproc = _iodbcdm_getproc( pstmt->hdbc, en_ExtendedFetch );
|
hproc = _iodbcdm_getproc (pstmt->hdbc, en_ExtendedFetch);
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
if (hproc == SQL_NULL_HPROC)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
PUSHSQLERR (pstmt->herr, en_IM001);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_ExtendedFetch, (
|
CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_ExtendedFetch,
|
||||||
pstmt->dhstmt,
|
(pstmt->dhstmt, fFetchType, irow, pcrow, rgfRowStatus))
|
||||||
fFetchType,
|
|
||||||
irow,
|
|
||||||
pcrow,
|
|
||||||
rgfRowStatus ) )
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
retcode = hproc(pstmt->dhstmt,
|
|
||||||
fFetchType,
|
|
||||||
irow,
|
|
||||||
pcrow,
|
|
||||||
rgfRowStatus );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* state transition */
|
/* state transition */
|
||||||
if( pstmt->asyn_on == en_ExtendedFetch )
|
if (pstmt->asyn_on == en_ExtendedFetch)
|
||||||
{
|
{
|
||||||
switch( retcode )
|
switch (retcode)
|
||||||
{
|
{
|
||||||
case SQL_SUCCESS:
|
case SQL_SUCCESS:
|
||||||
case SQL_SUCCESS_WITH_INFO:
|
case SQL_SUCCESS_WITH_INFO:
|
||||||
@@ -233,11 +230,11 @@ RETCODE SQL_API SQLExtendedFetch (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( pstmt->state )
|
switch (pstmt->state)
|
||||||
{
|
{
|
||||||
case en_stmt_cursoropen:
|
case en_stmt_cursoropen:
|
||||||
case en_stmt_xfetched:
|
case en_stmt_xfetched:
|
||||||
switch( retcode )
|
switch (retcode)
|
||||||
{
|
{
|
||||||
case SQL_SUCCESS:
|
case SQL_SUCCESS:
|
||||||
case SQL_SUCCESS_WITH_INFO:
|
case SQL_SUCCESS_WITH_INFO:
|
||||||
@@ -262,37 +259,38 @@ RETCODE SQL_API SQLExtendedFetch (
|
|||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETCODE SQL_API SQLGetData(
|
|
||||||
|
RETCODE SQL_API
|
||||||
|
SQLGetData (
|
||||||
HSTMT hstmt,
|
HSTMT hstmt,
|
||||||
UWORD icol,
|
UWORD icol,
|
||||||
SWORD fCType,
|
SWORD fCType,
|
||||||
PTR rgbValue,
|
PTR rgbValue,
|
||||||
SDWORD cbValueMax,
|
SDWORD cbValueMax,
|
||||||
SDWORD FAR* pcbValue )
|
SDWORD FAR * pcbValue)
|
||||||
{
|
{
|
||||||
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
STMT_t FAR *pstmt = (STMT_t FAR *) hstmt;
|
||||||
HPROC hproc;
|
HPROC hproc;
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
int sqlstat = en_00000;
|
int sqlstat = en_00000;
|
||||||
|
|
||||||
if( hstmt == SQL_NULL_HSTMT
|
if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC)
|
||||||
|| pstmt->hdbc == SQL_NULL_HDBC )
|
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check argument */
|
/* check argument */
|
||||||
if( rgbValue == NULL )
|
if (rgbValue == NULL)
|
||||||
{
|
{
|
||||||
sqlstat = en_S1009;
|
sqlstat = en_S1009;
|
||||||
}
|
}
|
||||||
else if( cbValueMax < 0 )
|
else if (cbValueMax < 0)
|
||||||
{
|
{
|
||||||
sqlstat = en_S1090;
|
sqlstat = en_S1090;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch(fCType)
|
switch (fCType)
|
||||||
{
|
{
|
||||||
case SQL_C_DEFAULT:
|
case SQL_C_DEFAULT:
|
||||||
case SQL_C_CHAR:
|
case SQL_C_CHAR:
|
||||||
@@ -320,17 +318,17 @@ RETCODE SQL_API SQLGetData(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( sqlstat != en_00000 )
|
if (sqlstat != en_00000)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, sqlstat );
|
PUSHSQLERR (pstmt->herr, sqlstat);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check state */
|
/* check state */
|
||||||
if( pstmt->asyn_on == en_NullProc )
|
if (pstmt->asyn_on == en_NullProc)
|
||||||
{
|
{
|
||||||
switch( pstmt->state )
|
switch (pstmt->state)
|
||||||
{
|
{
|
||||||
case en_stmt_allocated:
|
case en_stmt_allocated:
|
||||||
case en_stmt_prepared:
|
case en_stmt_prepared:
|
||||||
@@ -349,49 +347,35 @@ RETCODE SQL_API SQLGetData(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( pstmt->asyn_on != en_GetData )
|
else if (pstmt->asyn_on != en_GetData)
|
||||||
{
|
{
|
||||||
sqlstat = en_S1010;
|
sqlstat = en_S1010;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( sqlstat != en_00000 )
|
if (sqlstat != en_00000)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, sqlstat );
|
PUSHSQLERR (pstmt->herr, sqlstat);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* call driver */
|
/* call driver */
|
||||||
hproc = _iodbcdm_getproc( pstmt->hdbc, en_GetData );
|
hproc = _iodbcdm_getproc (pstmt->hdbc, en_GetData);
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
if (hproc == SQL_NULL_HPROC)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
PUSHSQLERR (pstmt->herr, en_IM001);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_GetData, (
|
CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_GetData,
|
||||||
pstmt->dhstmt,
|
(pstmt->dhstmt, icol, fCType, rgbValue, cbValueMax, pcbValue))
|
||||||
icol,
|
|
||||||
fCType,
|
|
||||||
rgbValue,
|
|
||||||
cbValueMax,
|
|
||||||
pcbValue ) )
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
retcode = hproc(pstmt->dhstmt,
|
|
||||||
icol,
|
|
||||||
fCType,
|
|
||||||
rgbValue,
|
|
||||||
cbValueMax,
|
|
||||||
pcbValue );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* state transition */
|
/* state transition */
|
||||||
if( pstmt->asyn_on == en_GetData )
|
if (pstmt->asyn_on == en_GetData)
|
||||||
{
|
{
|
||||||
switch ( retcode )
|
switch (retcode)
|
||||||
{
|
{
|
||||||
case SQL_SUCCESS:
|
case SQL_SUCCESS:
|
||||||
case SQL_SUCCESS_WITH_INFO:
|
case SQL_SUCCESS_WITH_INFO:
|
||||||
@@ -406,11 +390,11 @@ RETCODE SQL_API SQLGetData(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( pstmt->state )
|
switch (pstmt->state)
|
||||||
{
|
{
|
||||||
case en_stmt_fetched:
|
case en_stmt_fetched:
|
||||||
case en_stmt_xfetched:
|
case en_stmt_xfetched:
|
||||||
if( retcode == SQL_STILL_EXECUTING )
|
if (retcode == SQL_STILL_EXECUTING)
|
||||||
{
|
{
|
||||||
pstmt->asyn_on = en_GetData;
|
pstmt->asyn_on = en_GetData;
|
||||||
break;
|
break;
|
||||||
@@ -424,22 +408,24 @@ RETCODE SQL_API SQLGetData(
|
|||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETCODE SQL_API SQLMoreResults( HSTMT hstmt )
|
|
||||||
|
RETCODE SQL_API
|
||||||
|
SQLMoreResults (HSTMT hstmt)
|
||||||
{
|
{
|
||||||
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
STMT_t FAR *pstmt = (STMT_t FAR *) hstmt;
|
||||||
HPROC hproc;
|
HPROC hproc;
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
|
|
||||||
if( hstmt == SQL_NULL_HSTMT
|
if (hstmt == SQL_NULL_HSTMT
|
||||||
|| pstmt->hdbc == SQL_NULL_HDBC )
|
|| pstmt->hdbc == SQL_NULL_HDBC)
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check state */
|
/* check state */
|
||||||
if( pstmt->asyn_on == en_NullProc )
|
if (pstmt->asyn_on == en_NullProc)
|
||||||
{
|
{
|
||||||
switch( pstmt->state )
|
switch (pstmt->state)
|
||||||
{
|
{
|
||||||
case en_stmt_allocated:
|
case en_stmt_allocated:
|
||||||
case en_stmt_prepared:
|
case en_stmt_prepared:
|
||||||
@@ -448,40 +434,37 @@ RETCODE SQL_API SQLMoreResults( HSTMT hstmt )
|
|||||||
case en_stmt_needdata:
|
case en_stmt_needdata:
|
||||||
case en_stmt_mustput:
|
case en_stmt_mustput:
|
||||||
case en_stmt_canput:
|
case en_stmt_canput:
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1010 );
|
PUSHSQLERR (pstmt->herr, en_S1010);
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( pstmt->asyn_on != en_MoreResults )
|
else if (pstmt->asyn_on != en_MoreResults)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1010 );
|
PUSHSQLERR (pstmt->herr, en_S1010);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* call driver */
|
/* call driver */
|
||||||
hproc = _iodbcdm_getproc( pstmt->hdbc, en_MoreResults );
|
hproc = _iodbcdm_getproc (pstmt->hdbc, en_MoreResults);
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
if (hproc == SQL_NULL_HPROC)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
PUSHSQLERR (pstmt->herr, en_IM001);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_MoreResults, (pstmt->dhstmt) )
|
CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_MoreResults,
|
||||||
|
(pstmt->dhstmt))
|
||||||
#if 0
|
|
||||||
retcode = hproc( pstmt->dhstmt );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* state transition */
|
/* state transition */
|
||||||
if( pstmt->asyn_on == en_MoreResults )
|
if (pstmt->asyn_on == en_MoreResults)
|
||||||
{
|
{
|
||||||
switch( retcode )
|
switch (retcode)
|
||||||
{
|
{
|
||||||
case SQL_SUCCESS:
|
case SQL_SUCCESS:
|
||||||
case SQL_SUCCESS_WITH_INFO:
|
case SQL_SUCCESS_WITH_INFO:
|
||||||
@@ -496,7 +479,7 @@ RETCODE SQL_API SQLMoreResults( HSTMT hstmt )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( pstmt->state )
|
switch (pstmt->state)
|
||||||
{
|
{
|
||||||
case en_stmt_allocated:
|
case en_stmt_allocated:
|
||||||
case en_stmt_prepared:
|
case en_stmt_prepared:
|
||||||
@@ -504,9 +487,9 @@ RETCODE SQL_API SQLMoreResults( HSTMT hstmt )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case en_stmt_executed:
|
case en_stmt_executed:
|
||||||
if( retcode == SQL_NO_DATA_FOUND )
|
if (retcode == SQL_NO_DATA_FOUND)
|
||||||
{
|
{
|
||||||
if( pstmt->prep_state )
|
if (pstmt->prep_state)
|
||||||
{
|
{
|
||||||
pstmt->state = en_stmt_prepared;
|
pstmt->state = en_stmt_prepared;
|
||||||
}
|
}
|
||||||
@@ -515,7 +498,7 @@ RETCODE SQL_API SQLMoreResults( HSTMT hstmt )
|
|||||||
pstmt->state = en_stmt_allocated;
|
pstmt->state = en_stmt_allocated;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( retcode == SQL_STILL_EXECUTING )
|
else if (retcode == SQL_STILL_EXECUTING)
|
||||||
{
|
{
|
||||||
pstmt->asyn_on = en_MoreResults;
|
pstmt->asyn_on = en_MoreResults;
|
||||||
}
|
}
|
||||||
@@ -524,13 +507,13 @@ RETCODE SQL_API SQLMoreResults( HSTMT hstmt )
|
|||||||
case en_stmt_cursoropen:
|
case en_stmt_cursoropen:
|
||||||
case en_stmt_fetched:
|
case en_stmt_fetched:
|
||||||
case en_stmt_xfetched:
|
case en_stmt_xfetched:
|
||||||
if( retcode == SQL_SUCCESS )
|
if (retcode == SQL_SUCCESS)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if( retcode == SQL_NO_DATA_FOUND )
|
else if (retcode == SQL_NO_DATA_FOUND)
|
||||||
{
|
{
|
||||||
if( pstmt->prep_state )
|
if (pstmt->prep_state)
|
||||||
{
|
{
|
||||||
pstmt->state = en_stmt_prepared;
|
pstmt->state = en_stmt_prepared;
|
||||||
}
|
}
|
||||||
@@ -539,7 +522,7 @@ RETCODE SQL_API SQLMoreResults( HSTMT hstmt )
|
|||||||
pstmt->state = en_stmt_allocated;
|
pstmt->state = en_stmt_allocated;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( retcode == SQL_STILL_EXECUTING )
|
else if (retcode == SQL_STILL_EXECUTING)
|
||||||
{
|
{
|
||||||
pstmt->asyn_on = en_MoreResults;
|
pstmt->asyn_on = en_MoreResults;
|
||||||
}
|
}
|
||||||
@@ -552,34 +535,34 @@ RETCODE SQL_API SQLMoreResults( HSTMT hstmt )
|
|||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETCODE SQL_API SQLSetPos (
|
|
||||||
|
RETCODE SQL_API
|
||||||
|
SQLSetPos (
|
||||||
HSTMT hstmt,
|
HSTMT hstmt,
|
||||||
UWORD irow,
|
UWORD irow,
|
||||||
UWORD fOption,
|
UWORD fOption,
|
||||||
UWORD fLock )
|
UWORD fLock)
|
||||||
{
|
{
|
||||||
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
STMT_t FAR *pstmt = (STMT_t FAR *) hstmt;
|
||||||
HPROC hproc;
|
HPROC hproc;
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
int sqlstat = en_00000;
|
int sqlstat = en_00000;
|
||||||
|
|
||||||
if( hstmt == SQL_NULL_HSTMT
|
if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC)
|
||||||
|| pstmt->hdbc == SQL_NULL_HDBC )
|
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check argument value */
|
/* check argument value */
|
||||||
if( fOption > SQL_ADD
|
if (fOption > SQL_ADD || fLock > SQL_LOCK_UNLOCK)
|
||||||
|| fLock > SQL_LOCK_UNLOCK )
|
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1009 );
|
PUSHSQLERR (pstmt->herr, en_S1009);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check state */
|
/* check state */
|
||||||
if( pstmt->asyn_on == en_NullProc )
|
if (pstmt->asyn_on == en_NullProc)
|
||||||
{
|
{
|
||||||
switch( pstmt->state )
|
switch (pstmt->state)
|
||||||
{
|
{
|
||||||
case en_stmt_allocated:
|
case en_stmt_allocated:
|
||||||
case en_stmt_prepared:
|
case en_stmt_prepared:
|
||||||
@@ -599,44 +582,35 @@ RETCODE SQL_API SQLSetPos (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( pstmt->asyn_on != en_SetPos )
|
else if (pstmt->asyn_on != en_SetPos)
|
||||||
{
|
{
|
||||||
sqlstat = en_S1010;
|
sqlstat = en_S1010;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( sqlstat != en_00000 )
|
if (sqlstat != en_00000)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, sqlstat );
|
PUSHSQLERR (pstmt->herr, sqlstat);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* call driver */
|
/* call driver */
|
||||||
hproc = _iodbcdm_getproc( pstmt->hdbc, en_SetPos );
|
hproc = _iodbcdm_getproc (pstmt->hdbc, en_SetPos);
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
if (hproc == SQL_NULL_HPROC)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
PUSHSQLERR (pstmt->herr, en_IM001);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_SetPos, (
|
CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_SetPos,
|
||||||
pstmt->dhstmt,
|
(pstmt->dhstmt, irow, fOption, fLock))
|
||||||
irow,
|
|
||||||
fOption,
|
|
||||||
fLock ) )
|
|
||||||
#if 0
|
|
||||||
retcode = hproc(pstmt->dhstmt,
|
|
||||||
irow,
|
|
||||||
fOption,
|
|
||||||
fLock );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* state transition */
|
/* state transition */
|
||||||
if( pstmt->asyn_on == en_SetPos )
|
if (pstmt->asyn_on == en_SetPos)
|
||||||
{
|
{
|
||||||
switch( retcode )
|
switch (retcode)
|
||||||
{
|
{
|
||||||
case SQL_SUCCESS:
|
case SQL_SUCCESS:
|
||||||
case SQL_SUCCESS_WITH_INFO:
|
case SQL_SUCCESS_WITH_INFO:
|
||||||
@@ -652,7 +626,7 @@ RETCODE SQL_API SQLSetPos (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* now, the only possible init state is 'xfetched' */
|
/* now, the only possible init state is 'xfetched' */
|
||||||
switch( retcode )
|
switch (retcode)
|
||||||
{
|
{
|
||||||
case SQL_SUCCESS:
|
case SQL_SUCCESS:
|
||||||
case SQL_SUCCESS_WITH_INFO:
|
case SQL_SUCCESS_WITH_INFO:
|
||||||
|
|||||||
453
src/iodbc/hdbc.c
453
src/iodbc/hdbc.c
@@ -1,66 +1,79 @@
|
|||||||
/** data source connect object management functions
|
/*
|
||||||
|
* hdbc.c
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Data source connect object management functions
|
||||||
|
*
|
||||||
|
* The iODBC driver manager.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free
|
||||||
|
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
#include <config.h>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
#include <isql.h>
|
||||||
it under the terms of the GNU General Public License as published by
|
#include <isqlext.h>
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
#include <dlproc.h>
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
**/
|
|
||||||
|
|
||||||
#include <../iodbc/iodbc.h>
|
#include <herr.h>
|
||||||
|
#include <henv.h>
|
||||||
|
#include <hdbc.h>
|
||||||
|
#include <hstmt.h>
|
||||||
|
|
||||||
#include <../iodbc/isql.h>
|
#include <itrace.h>
|
||||||
#include <../iodbc/isqlext.h>
|
|
||||||
|
|
||||||
#include <../iodbc/dlproc.h>
|
|
||||||
|
|
||||||
#include <../iodbc/herr.h>
|
|
||||||
#include <../iodbc/henv.h>
|
|
||||||
#include <../iodbc/hdbc.h>
|
|
||||||
#include <../iodbc/hstmt.h>
|
|
||||||
|
|
||||||
#include <../iodbc/itrace.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
extern RETCODE _iodbcdm_driverunload();
|
extern RETCODE _iodbcdm_driverunload();
|
||||||
|
|
||||||
RETCODE SQL_API SQLAllocConnect(
|
|
||||||
|
RETCODE SQL_API
|
||||||
|
SQLAllocConnect (
|
||||||
HENV henv,
|
HENV henv,
|
||||||
HDBC FAR* phdbc )
|
HDBC FAR * phdbc)
|
||||||
{
|
{
|
||||||
GENV_t FAR* genv = (GENV_t FAR*)henv;
|
GENV_t FAR *genv = (GENV_t FAR *) henv;
|
||||||
DBC_t FAR* pdbc;
|
DBC_t FAR *pdbc;
|
||||||
|
|
||||||
#if (ODBCVER >= 0x0300)
|
#if (ODBCVER >= 0x0300)
|
||||||
if( henv == SQL_NULL_HENV
|
if (henv == SQL_NULL_HENV || genv->type != SQL_HANDLE_ENV)
|
||||||
|| genv->type != SQL_HANDLE_ENV )
|
|
||||||
#else
|
#else
|
||||||
if( henv == SQL_NULL_HENV )
|
if (henv == SQL_NULL_HENV)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( phdbc == NULL )
|
if (phdbc == NULL)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( genv->herr, en_S1009 );
|
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 )
|
if (pdbc == NULL)
|
||||||
{
|
{
|
||||||
*phdbc = SQL_NULL_HDBC;
|
*phdbc = SQL_NULL_HDBC;
|
||||||
|
|
||||||
PUSHSQLERR ( genv->herr, en_S1001 );
|
PUSHSQLERR (genv->herr, en_S1001);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
@@ -68,16 +81,17 @@ RETCODE SQL_API SQLAllocConnect(
|
|||||||
#if (ODBCVER >= 0x0300)
|
#if (ODBCVER >= 0x0300)
|
||||||
pdbc->type = SQL_HANDLE_DBC;
|
pdbc->type = SQL_HANDLE_DBC;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* insert this dbc entry into the link list */
|
/* insert this dbc entry into the link list */
|
||||||
pdbc->next = genv->hdbc;
|
pdbc->next = genv->hdbc;
|
||||||
genv->hdbc = pdbc;
|
genv->hdbc = pdbc;
|
||||||
pdbc->genv = henv;
|
pdbc->genv = henv;
|
||||||
|
|
||||||
pdbc->henv = SQL_NULL_HENV;
|
pdbc->henv = SQL_NULL_HENV;
|
||||||
pdbc->hstmt= SQL_NULL_HSTMT;
|
pdbc->hstmt = SQL_NULL_HSTMT;
|
||||||
pdbc->herr = SQL_NULL_HERR;
|
pdbc->herr = SQL_NULL_HERR;
|
||||||
pdbc->dhdbc= SQL_NULL_HDBC;
|
pdbc->dhdbc = SQL_NULL_HDBC;
|
||||||
pdbc->state= en_dbc_allocated;
|
pdbc->state = en_dbc_allocated;
|
||||||
pdbc->trace = 0;
|
pdbc->trace = 0;
|
||||||
pdbc->tstm = NULL;
|
pdbc->tstm = NULL;
|
||||||
pdbc->tfile = NULL;
|
pdbc->tfile = NULL;
|
||||||
@@ -89,48 +103,50 @@ RETCODE SQL_API SQLAllocConnect(
|
|||||||
pdbc->login_timeout = 0UL;
|
pdbc->login_timeout = 0UL;
|
||||||
pdbc->odbc_cursors = SQL_CUR_DEFAULT;
|
pdbc->odbc_cursors = SQL_CUR_DEFAULT;
|
||||||
pdbc->packet_size = 0UL;
|
pdbc->packet_size = 0UL;
|
||||||
pdbc->quiet_mode = (UDWORD)NULL;
|
pdbc->quiet_mode = (UDWORD) NULL;
|
||||||
pdbc->txn_isolation = SQL_TXN_READ_UNCOMMITTED;
|
pdbc->txn_isolation = SQL_TXN_READ_UNCOMMITTED;
|
||||||
pdbc->cb_commit = (SWORD)SQL_CB_DELETE;
|
pdbc->cb_commit = (SWORD) SQL_CB_DELETE;
|
||||||
pdbc->cb_rollback = (SWORD)SQL_CB_DELETE;
|
pdbc->cb_rollback = (SWORD) SQL_CB_DELETE;
|
||||||
|
|
||||||
*phdbc = (HDBC)pdbc;
|
*phdbc = (HDBC) pdbc;
|
||||||
|
|
||||||
return SQL_SUCCESS;
|
return SQL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
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 )
|
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;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check state */
|
/* check state */
|
||||||
if( pdbc->state != en_dbc_allocated )
|
if (pdbc->state != en_dbc_allocated)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pdbc->herr, en_S1010 );
|
PUSHSQLERR (pdbc->herr, en_S1010);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
genv = (GENV_t FAR*)pdbc->genv;
|
genv = (GENV_t FAR *) pdbc->genv;
|
||||||
|
|
||||||
for( tpdbc = (DBC_t FAR*)genv->hdbc;
|
for (tpdbc = (DBC_t FAR *) genv->hdbc;
|
||||||
tpdbc != NULL;
|
tpdbc != NULL;
|
||||||
tpdbc = tpdbc->next )
|
tpdbc = tpdbc->next)
|
||||||
{
|
{
|
||||||
if( pdbc == tpdbc )
|
if (pdbc == tpdbc)
|
||||||
{
|
{
|
||||||
genv->hdbc = pdbc->next;
|
genv->hdbc = pdbc->next;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdbc == tpdbc->next )
|
if (pdbc == tpdbc->next)
|
||||||
{
|
{
|
||||||
tpdbc->next = pdbc->next;
|
tpdbc->next = pdbc->next;
|
||||||
break;
|
break;
|
||||||
@@ -138,54 +154,54 @@ RETCODE SQL_API SQLFreeConnect( HDBC hdbc )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* free this dbc */
|
/* free this dbc */
|
||||||
_iodbcdm_driverunload(pdbc);
|
_iodbcdm_driverunload (pdbc);
|
||||||
_iodbcdm_freesqlerrlist( pdbc->herr );
|
_iodbcdm_freesqlerrlist (pdbc->herr);
|
||||||
|
|
||||||
if( pdbc->tfile )
|
if (pdbc->tfile)
|
||||||
{
|
{
|
||||||
MEM_FREE( pdbc->tfile );
|
MEM_FREE (pdbc->tfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
SQLSetConnectOption( pdbc, SQL_OPT_TRACE, SQL_OPT_TRACE_OFF);
|
SQLSetConnectOption (pdbc, SQL_OPT_TRACE, SQL_OPT_TRACE_OFF);
|
||||||
|
|
||||||
MEM_FREE ( pdbc );
|
MEM_FREE (pdbc);
|
||||||
|
|
||||||
return SQL_SUCCESS;
|
return SQL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETCODE SQL_API SQLSetConnectOption(
|
|
||||||
|
RETCODE SQL_API
|
||||||
|
SQLSetConnectOption (
|
||||||
HDBC hdbc,
|
HDBC hdbc,
|
||||||
UWORD fOption,
|
UWORD fOption,
|
||||||
UDWORD vParam )
|
UDWORD vParam)
|
||||||
{
|
{
|
||||||
GENV_t FAR* genv;
|
GENV_t FAR *genv;
|
||||||
DBC_t FAR* pdbc = (DBC_t FAR*)hdbc;
|
DBC_t FAR *pdbc = (DBC_t FAR *) hdbc;
|
||||||
STMT_t FAR* pstmt;
|
STMT_t FAR *pstmt;
|
||||||
HPROC hproc = SQL_NULL_HPROC;
|
HPROC hproc = SQL_NULL_HPROC;
|
||||||
int sqlstat = en_00000;
|
int sqlstat = en_00000;
|
||||||
RETCODE retcode = SQL_SUCCESS;
|
RETCODE retcode = SQL_SUCCESS;
|
||||||
|
|
||||||
if( hdbc == SQL_NULL_HDBC )
|
if (hdbc == SQL_NULL_HDBC)
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check option */
|
/* check option */
|
||||||
if( fOption < SQL_CONN_OPT_MIN
|
if (fOption < SQL_CONN_OPT_MIN ||
|
||||||
|| ( fOption > SQL_CONN_OPT_MAX
|
(fOption > SQL_CONN_OPT_MAX && fOption < SQL_CONNECT_OPT_DRVR_START))
|
||||||
&& fOption < SQL_CONNECT_OPT_DRVR_START ) )
|
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pdbc->herr, en_S1092 );
|
PUSHSQLERR (pdbc->herr, en_S1092);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check state of connection handle */
|
/* check state of connection handle */
|
||||||
switch( pdbc->state )
|
switch (pdbc->state)
|
||||||
{
|
{
|
||||||
case en_dbc_allocated:
|
case en_dbc_allocated:
|
||||||
if( fOption == SQL_TRANSLATE_DLL
|
if (fOption == SQL_TRANSLATE_DLL || fOption == SQL_TRANSLATE_OPTION)
|
||||||
|| fOption == SQL_TRANSLATE_OPTION )
|
|
||||||
{
|
{
|
||||||
/* This two options are only meaningful
|
/* This two options are only meaningful
|
||||||
* for specified driver. So, has to be
|
* for specified driver. So, has to be
|
||||||
@@ -195,8 +211,7 @@ RETCODE SQL_API SQLSetConnectOption(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( fOption >= SQL_CONNECT_OPT_DRVR_START
|
if (fOption >= SQL_CONNECT_OPT_DRVR_START && pdbc->henv == SQL_NULL_HENV)
|
||||||
&& pdbc->henv == SQL_NULL_HENV )
|
|
||||||
/* An option only meaningful for drivers
|
/* An option only meaningful for drivers
|
||||||
* is passed before loading a driver.
|
* is passed before loading a driver.
|
||||||
* We classify this as an invalid option error.
|
* We classify this as an invalid option error.
|
||||||
@@ -214,7 +229,7 @@ RETCODE SQL_API SQLSetConnectOption(
|
|||||||
|
|
||||||
case en_dbc_connected:
|
case en_dbc_connected:
|
||||||
case en_dbc_hstmt:
|
case en_dbc_hstmt:
|
||||||
if( fOption == SQL_ODBC_CURSORS )
|
if (fOption == SQL_ODBC_CURSORS)
|
||||||
{
|
{
|
||||||
sqlstat = en_08002;
|
sqlstat = en_08002;
|
||||||
}
|
}
|
||||||
@@ -225,69 +240,69 @@ RETCODE SQL_API SQLSetConnectOption(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* check state of statement handle(s) */
|
/* check state of statement handle(s) */
|
||||||
for( pstmt = (STMT_t FAR*)pdbc->hstmt;
|
for (pstmt = (STMT_t FAR *) pdbc->hstmt;
|
||||||
pstmt != NULL && sqlstat == en_00000;
|
pstmt != NULL && sqlstat == en_00000;
|
||||||
pstmt = (STMT_t FAR*)pstmt->next )
|
pstmt = (STMT_t FAR *) pstmt->next)
|
||||||
{
|
{
|
||||||
if( pstmt->state >= en_stmt_needdata
|
if (pstmt->state >= en_stmt_needdata || pstmt->asyn_on != en_NullProc)
|
||||||
|| pstmt->asyn_on != en_NullProc )
|
|
||||||
{
|
{
|
||||||
sqlstat = en_S1010;
|
sqlstat = en_S1010;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( sqlstat != en_00000 )
|
if (sqlstat != en_00000)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pdbc->herr, sqlstat );
|
PUSHSQLERR (pdbc->herr, sqlstat);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( fOption == SQL_OPT_TRACE )
|
if (fOption == SQL_OPT_TRACE)
|
||||||
/* tracing flag can be set before and after connect
|
/* tracing flag can be set before and after connect
|
||||||
* and only meaningful for driver manager(actually
|
* and only meaningful for driver manager(actually
|
||||||
* there is only one tracing file under one global
|
* there is only one tracing file under one global
|
||||||
* environment).
|
* environment).
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
switch( vParam )
|
switch (vParam)
|
||||||
{
|
{
|
||||||
case SQL_OPT_TRACE_ON:
|
case SQL_OPT_TRACE_ON:
|
||||||
if( pdbc->tfile == NULL )
|
if (pdbc->tfile == NULL)
|
||||||
{
|
{
|
||||||
pdbc->tfile = (char FAR*)MEM_ALLOC( 1 +
|
pdbc->tfile = (char FAR *) MEM_ALLOC (1 +
|
||||||
STRLEN(SQL_OPT_TRACE_FILE_DEFAULT) );
|
STRLEN (SQL_OPT_TRACE_FILE_DEFAULT));
|
||||||
|
|
||||||
if( pdbc->tfile == NULL )
|
if (pdbc->tfile == NULL)
|
||||||
{
|
{
|
||||||
PUSHSQLERR( pdbc->herr, en_S1001 );
|
PUSHSQLERR (pdbc->herr, en_S1001);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
STRCPY( pdbc->tfile, SQL_OPT_TRACE_FILE_DEFAULT );
|
STRCPY (pdbc->tfile, SQL_OPT_TRACE_FILE_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdbc->tstm == NULL )
|
if (pdbc->tstm == NULL)
|
||||||
{
|
{
|
||||||
|
|
||||||
#if defined(stderr) && defined(stdout)
|
#if defined(stderr) && defined(stdout)
|
||||||
if(STREQ( pdbc->tfile, "stderr"))
|
if (STREQ (pdbc->tfile, "stderr"))
|
||||||
{
|
{
|
||||||
pdbc->tstm = stderr;
|
pdbc->tstm = stderr;
|
||||||
}
|
}
|
||||||
else
|
else if (STREQ (pdbc->tfile, "stdout"))
|
||||||
if(STREQ(pdbc->tfile, "stdout"))
|
|
||||||
{
|
{
|
||||||
pdbc->tstm = stdout;
|
pdbc->tstm = stdout;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
pdbc->tstm
|
pdbc->tstm
|
||||||
= fopen(pdbc->tfile, "a+");
|
= fopen (pdbc->tfile, "a+");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pdbc->tstm )
|
if (pdbc->tstm)
|
||||||
{
|
{
|
||||||
pdbc->trace = 1;
|
pdbc->trace = 1;
|
||||||
}
|
}
|
||||||
@@ -302,14 +317,16 @@ RETCODE SQL_API SQLSetConnectOption(
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SQL_OPT_TRACE_OFF:
|
case SQL_OPT_TRACE_OFF:
|
||||||
if( pdbc->trace && pdbc->tstm )
|
if (pdbc->trace && pdbc->tstm)
|
||||||
{
|
{
|
||||||
|
|
||||||
#if defined(stderr) && defined(stdout)
|
#if defined(stderr) && defined(stdout)
|
||||||
if( stderr != (FILE FAR*)(pdbc->tstm)
|
if (stderr != (FILE FAR *) (pdbc->tstm)
|
||||||
&& stdout != (FILE FAR*)(pdbc->tstm) )
|
&& stdout != (FILE FAR *) (pdbc->tstm))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
fclose(pdbc->tstm);
|
fclose (pdbc->tstm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pdbc->tstm = NULL;
|
pdbc->tstm = NULL;
|
||||||
@@ -321,83 +338,77 @@ RETCODE SQL_API SQLSetConnectOption(
|
|||||||
retcode = SQL_ERROR;
|
retcode = SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( sqlstat != en_00000 )
|
if (sqlstat != en_00000)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pdbc->herr, sqlstat );
|
PUSHSQLERR (pdbc->herr, sqlstat);
|
||||||
}
|
}
|
||||||
|
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( fOption == SQL_OPT_TRACEFILE )
|
if (fOption == SQL_OPT_TRACEFILE)
|
||||||
/* Tracing file can be set before and after connect
|
/* Tracing file can be set before and after connect
|
||||||
* and only meaningful for driver manager.
|
* and only meaningful for driver manager.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
if( vParam == 0UL
|
if (vParam == 0UL || ((char FAR *) vParam)[0] == 0)
|
||||||
|| ((char FAR*)vParam)[0] == 0 )
|
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pdbc->herr, en_S1009 );
|
PUSHSQLERR (pdbc->herr, en_S1009);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdbc->tfile && STREQ (pdbc->tfile, vParam) )
|
if (pdbc->tfile && STREQ (pdbc->tfile, vParam))
|
||||||
{
|
{
|
||||||
return SQL_SUCCESS;
|
return SQL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdbc->trace )
|
if (pdbc->trace)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pdbc->herr, en_IM014 );
|
PUSHSQLERR (pdbc->herr, en_IM014);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdbc->tfile )
|
if (pdbc->tfile)
|
||||||
{
|
{
|
||||||
MEM_FREE( pdbc->tfile );
|
MEM_FREE (pdbc->tfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
pdbc->tfile = (char FAR*)MEM_ALLOC( 1 + STRLEN( vParam ) );
|
pdbc->tfile = (char FAR *) MEM_ALLOC (1 + STRLEN (vParam));
|
||||||
|
|
||||||
if( pdbc->tfile == NULL )
|
if (pdbc->tfile == NULL)
|
||||||
{
|
{
|
||||||
PUSHSQLERR( pdbc->herr, en_S1001 );
|
PUSHSQLERR (pdbc->herr, en_S1001);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
STRCPY ( pdbc->tfile, vParam );
|
STRCPY (pdbc->tfile, vParam);
|
||||||
|
|
||||||
return SQL_SUCCESS;
|
return SQL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdbc->state != en_dbc_allocated )
|
if (pdbc->state != en_dbc_allocated)
|
||||||
{
|
{
|
||||||
/* If already connected, then, driver's odbc call
|
/* If already connected, then, driver's odbc call
|
||||||
* will be invoked. Otherwise, we only save the options
|
* will be invoked. Otherwise, we only save the options
|
||||||
* and delay the setting process until the connection
|
* and delay the setting process until the connection
|
||||||
* been established.
|
* been established.
|
||||||
*/
|
*/
|
||||||
hproc = _iodbcdm_getproc( hdbc, en_SetConnectOption );
|
hproc = _iodbcdm_getproc (hdbc, en_SetConnectOption);
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
if (hproc == SQL_NULL_HPROC)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pdbc->herr, en_IM001 );
|
PUSHSQLERR (pdbc->herr, en_IM001);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
CALL_DRIVER ( hdbc, retcode, hproc, en_SetConnectOption, (
|
CALL_DRIVER (hdbc, retcode, hproc, en_SetConnectOption,
|
||||||
pdbc->dhdbc, fOption, vParam ) )
|
(pdbc->dhdbc, fOption, vParam))
|
||||||
|
|
||||||
#if 0
|
if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO)
|
||||||
retcode = hproc( pdbc->dhdbc, fOption, vParam);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if( retcode != SQL_SUCCESS
|
|
||||||
&& retcode != SQL_SUCCESS_WITH_INFO )
|
|
||||||
{
|
{
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
@@ -415,7 +426,7 @@ RETCODE SQL_API SQLSetConnectOption(
|
|||||||
/* No matter what state we are(i.e. allocated or connected, ..)
|
/* No matter what state we are(i.e. allocated or connected, ..)
|
||||||
* we need to flip the flag.
|
* we need to flip the flag.
|
||||||
*/
|
*/
|
||||||
switch( fOption )
|
switch (fOption)
|
||||||
{
|
{
|
||||||
case SQL_ACCESS_MODE:
|
case SQL_ACCESS_MODE:
|
||||||
pdbc->access_mode = vParam;
|
pdbc->access_mode = vParam;
|
||||||
@@ -427,7 +438,7 @@ RETCODE SQL_API SQLSetConnectOption(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* state transition */
|
/* state transition */
|
||||||
if( pdbc->state != en_dbc_allocated )
|
if (pdbc->state != en_dbc_allocated)
|
||||||
{
|
{
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
@@ -435,15 +446,15 @@ RETCODE SQL_API SQLSetConnectOption(
|
|||||||
/* Only 'allocated' state is possible here, and we need to
|
/* Only 'allocated' state is possible here, and we need to
|
||||||
* save the options for delaied setting.
|
* save the options for delaied setting.
|
||||||
*/
|
*/
|
||||||
switch( fOption )
|
switch (fOption)
|
||||||
{
|
{
|
||||||
case SQL_CURRENT_QUALIFIER:
|
case SQL_CURRENT_QUALIFIER:
|
||||||
if( pdbc->current_qualifier != NULL )
|
if (pdbc->current_qualifier != NULL)
|
||||||
{
|
{
|
||||||
MEM_FREE ( pdbc->current_qualifier );
|
MEM_FREE (pdbc->current_qualifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( vParam == 0UL )
|
if (vParam == 0UL)
|
||||||
{
|
{
|
||||||
pdbc->current_qualifier = NULL;
|
pdbc->current_qualifier = NULL;
|
||||||
|
|
||||||
@@ -451,16 +462,16 @@ RETCODE SQL_API SQLSetConnectOption(
|
|||||||
}
|
}
|
||||||
|
|
||||||
pdbc->current_qualifier
|
pdbc->current_qualifier
|
||||||
= (char FAR*)MEM_ALLOC (
|
= (char FAR *) MEM_ALLOC (
|
||||||
STRLEN (vParam) + 1 );
|
STRLEN (vParam) + 1);
|
||||||
|
|
||||||
if( pdbc->current_qualifier == NULL )
|
if (pdbc->current_qualifier == NULL)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pdbc->herr, en_S1001 );
|
PUSHSQLERR (pdbc->herr, en_S1001);
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
STRCPY ( pdbc->current_qualifier, vParam );
|
STRCPY (pdbc->current_qualifier, vParam);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SQL_LOGIN_TIMEOUT:
|
case SQL_LOGIN_TIMEOUT:
|
||||||
@@ -493,41 +504,42 @@ RETCODE SQL_API SQLSetConnectOption(
|
|||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETCODE SQL_API SQLGetConnectOption(
|
|
||||||
|
RETCODE SQL_API
|
||||||
|
SQLGetConnectOption (
|
||||||
HDBC hdbc,
|
HDBC hdbc,
|
||||||
UWORD fOption,
|
UWORD fOption,
|
||||||
PTR pvParam )
|
PTR pvParam)
|
||||||
{
|
{
|
||||||
GENV_t FAR* genv;
|
GENV_t FAR *genv;
|
||||||
DBC_t FAR* pdbc = (DBC_t FAR*)hdbc;
|
DBC_t FAR *pdbc = (DBC_t FAR *) hdbc;
|
||||||
int sqlstat = en_00000;
|
int sqlstat = en_00000;
|
||||||
HPROC hproc = SQL_NULL_HPROC;
|
HPROC hproc = SQL_NULL_HPROC;
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
|
|
||||||
if( hdbc == SQL_NULL_HDBC )
|
if (hdbc == SQL_NULL_HDBC)
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check option */
|
/* check option */
|
||||||
if( fOption < SQL_CONN_OPT_MIN
|
if (fOption < SQL_CONN_OPT_MIN ||
|
||||||
|| ( fOption > SQL_CONN_OPT_MAX
|
(fOption > SQL_CONN_OPT_MAX && fOption < SQL_CONNECT_OPT_DRVR_START))
|
||||||
&& fOption < SQL_CONNECT_OPT_DRVR_START ) )
|
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pdbc->herr, en_S1092 );
|
PUSHSQLERR (pdbc->herr, en_S1092);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check state */
|
/* check state */
|
||||||
switch( pdbc->state )
|
switch (pdbc->state)
|
||||||
{
|
{
|
||||||
case en_dbc_allocated:
|
case en_dbc_allocated:
|
||||||
if( fOption != SQL_ACCESS_MODE
|
if (fOption != SQL_ACCESS_MODE
|
||||||
&& fOption != SQL_AUTOCOMMIT
|
&& fOption != SQL_AUTOCOMMIT
|
||||||
&& fOption != SQL_LOGIN_TIMEOUT
|
&& fOption != SQL_LOGIN_TIMEOUT
|
||||||
&& fOption != SQL_OPT_TRACE
|
&& fOption != SQL_OPT_TRACE
|
||||||
&& fOption != SQL_OPT_TRACEFILE )
|
&& fOption != SQL_OPT_TRACEFILE)
|
||||||
{
|
{
|
||||||
sqlstat = en_08003;
|
sqlstat = en_08003;
|
||||||
}
|
}
|
||||||
@@ -549,9 +561,9 @@ RETCODE SQL_API SQLGetConnectOption(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( sqlstat != en_00000 )
|
if (sqlstat != en_00000)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pdbc->herr, sqlstat );
|
PUSHSQLERR (pdbc->herr, sqlstat);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
@@ -559,41 +571,37 @@ RETCODE SQL_API SQLGetConnectOption(
|
|||||||
/* Tracing and tracing file options are only
|
/* Tracing and tracing file options are only
|
||||||
* meaningful for driver manager
|
* meaningful for driver manager
|
||||||
*/
|
*/
|
||||||
if( fOption == SQL_OPT_TRACE )
|
if (fOption == SQL_OPT_TRACE)
|
||||||
{
|
{
|
||||||
if( pdbc->trace )
|
if (pdbc->trace)
|
||||||
*((UDWORD*)pvParam) = (UDWORD)SQL_OPT_TRACE_ON;
|
*((UDWORD *) pvParam) = (UDWORD) SQL_OPT_TRACE_ON;
|
||||||
else
|
else
|
||||||
*((UDWORD*)pvParam) = (UDWORD)SQL_OPT_TRACE_OFF;
|
*((UDWORD *) pvParam) = (UDWORD) SQL_OPT_TRACE_OFF;
|
||||||
|
|
||||||
return SQL_SUCCESS;
|
return SQL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( fOption == SQL_OPT_TRACEFILE )
|
if (fOption == SQL_OPT_TRACEFILE)
|
||||||
{
|
{
|
||||||
STRCPY (pvParam, pdbc->tfile );
|
STRCPY (pvParam, pdbc->tfile);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdbc->state != en_dbc_allocated )
|
if (pdbc->state != en_dbc_allocated)
|
||||||
/* if already connected, we will invoke driver's function */
|
/* if already connected, we will invoke driver's function */
|
||||||
{
|
{
|
||||||
hproc = _iodbcdm_getproc( hdbc, en_GetConnectOption );
|
hproc = _iodbcdm_getproc (hdbc, en_GetConnectOption);
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
if (hproc == SQL_NULL_HPROC)
|
||||||
{
|
{
|
||||||
PUSHSQLERR( pdbc->herr, en_IM001 );
|
PUSHSQLERR (pdbc->herr, en_IM001);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
CALL_DRIVER ( hdbc, retcode, hproc, en_GetConnectOption, (
|
CALL_DRIVER (hdbc, retcode, hproc, en_GetConnectOption,
|
||||||
pdbc->dhdbc, fOption, pvParam ) )
|
(pdbc->dhdbc, fOption, pvParam))
|
||||||
|
|
||||||
#if 0
|
|
||||||
retcode = hproc(pdbc->dhdbc, fOption, pvParam);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
@@ -603,18 +611,18 @@ RETCODE SQL_API SQLGetConnectOption(
|
|||||||
* options which has been handled and returned). Thus,
|
* options which has been handled and returned). Thus,
|
||||||
* there are only two possible cases.
|
* there are only two possible cases.
|
||||||
*/
|
*/
|
||||||
switch( fOption )
|
switch (fOption)
|
||||||
{
|
{
|
||||||
case SQL_ACCESS_MODE:
|
case SQL_ACCESS_MODE:
|
||||||
*((UDWORD*)pvParam) = pdbc->access_mode;
|
*((UDWORD *) pvParam) = pdbc->access_mode;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SQL_AUTOCOMMIT:
|
case SQL_AUTOCOMMIT:
|
||||||
*((UDWORD*)pvParam) = pdbc->autocommit;
|
*((UDWORD *) pvParam) = pdbc->autocommit;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SQL_LOGIN_TIMEOUT:
|
case SQL_LOGIN_TIMEOUT:
|
||||||
*((UDWORD*)pvParam) = pdbc->login_timeout;
|
*((UDWORD *) pvParam) = pdbc->login_timeout;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -624,21 +632,23 @@ RETCODE SQL_API SQLGetConnectOption(
|
|||||||
return SQL_SUCCESS;
|
return SQL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static RETCODE _iodbcdm_transact(
|
|
||||||
|
static RETCODE
|
||||||
|
_iodbcdm_transact (
|
||||||
HDBC hdbc,
|
HDBC hdbc,
|
||||||
UWORD fType )
|
UWORD fType)
|
||||||
{
|
{
|
||||||
DBC_t FAR* pdbc = (DBC_t FAR*)hdbc;
|
DBC_t FAR *pdbc = (DBC_t FAR *) hdbc;
|
||||||
STMT_t FAR* pstmt;
|
STMT_t FAR *pstmt;
|
||||||
HPROC hproc;
|
HPROC hproc;
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
|
|
||||||
/* check state */
|
/* check state */
|
||||||
switch( pdbc->state )
|
switch (pdbc->state)
|
||||||
{
|
{
|
||||||
case en_dbc_allocated:
|
case en_dbc_allocated:
|
||||||
case en_dbc_needdata:
|
case en_dbc_needdata:
|
||||||
PUSHSQLERR ( pdbc->herr, en_08003 );
|
PUSHSQLERR (pdbc->herr, en_08003);
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
|
|
||||||
case en_dbc_connected:
|
case en_dbc_connected:
|
||||||
@@ -649,53 +659,48 @@ static RETCODE _iodbcdm_transact(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( pstmt = (STMT_t FAR*)(pdbc->hstmt);
|
for (pstmt = (STMT_t FAR *) (pdbc->hstmt);
|
||||||
pstmt != NULL;
|
pstmt != NULL;
|
||||||
pstmt = pstmt->next )
|
pstmt = pstmt->next)
|
||||||
{
|
{
|
||||||
if( pstmt->state >= en_stmt_needdata
|
if (pstmt->state >= en_stmt_needdata
|
||||||
|| pstmt->asyn_on != en_NullProc )
|
|| pstmt->asyn_on != en_NullProc)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pdbc->herr, en_S1010 );
|
PUSHSQLERR (pdbc->herr, en_S1010);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
hproc = _iodbcdm_getproc( hdbc, en_Transact );
|
hproc = _iodbcdm_getproc (hdbc, en_Transact);
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
if (hproc == SQL_NULL_HPROC)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pdbc->herr, en_IM001 );
|
PUSHSQLERR (pdbc->herr, en_IM001);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
CALL_DRIVER ( hdbc, retcode, hproc, en_Transact, (
|
CALL_DRIVER (hdbc, retcode, hproc, en_Transact,
|
||||||
SQL_NULL_HENV, pdbc->dhdbc, fType ) )
|
(SQL_NULL_HENV, pdbc->dhdbc, fType))
|
||||||
|
|
||||||
#if 0
|
|
||||||
retcode = hproc( SQL_NULL_HENV, pdbc->dhdbc, fType );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* state transition */
|
/* state transition */
|
||||||
if( retcode != SQL_SUCCESS
|
if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO)
|
||||||
&& retcode != SQL_SUCCESS_WITH_INFO )
|
|
||||||
{
|
{
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
pdbc->state = en_dbc_hstmt;
|
pdbc->state = en_dbc_hstmt;
|
||||||
|
|
||||||
for( pstmt = (STMT_t FAR*)(pdbc->hstmt);
|
for (pstmt = (STMT_t FAR *) (pdbc->hstmt);
|
||||||
pstmt != NULL;
|
pstmt != NULL;
|
||||||
pstmt = pstmt->next )
|
pstmt = pstmt->next)
|
||||||
{
|
{
|
||||||
switch( pstmt->state )
|
switch (pstmt->state)
|
||||||
{
|
{
|
||||||
case en_stmt_prepared:
|
case en_stmt_prepared:
|
||||||
if( pdbc->cb_commit == SQL_CB_DELETE
|
if (pdbc->cb_commit == SQL_CB_DELETE
|
||||||
|| pdbc->cb_rollback == SQL_CB_DELETE )
|
|| pdbc->cb_rollback == SQL_CB_DELETE)
|
||||||
{
|
{
|
||||||
pstmt->state = en_stmt_allocated;
|
pstmt->state = en_stmt_allocated;
|
||||||
pstmt->prep_state = 0;
|
pstmt->prep_state = 0;
|
||||||
@@ -707,9 +712,9 @@ static RETCODE _iodbcdm_transact(
|
|||||||
case en_stmt_cursoropen:
|
case en_stmt_cursoropen:
|
||||||
case en_stmt_fetched:
|
case en_stmt_fetched:
|
||||||
case en_stmt_xfetched:
|
case en_stmt_xfetched:
|
||||||
if( ! pstmt->prep_state
|
if (!pstmt->prep_state
|
||||||
&& pdbc->cb_commit != SQL_CB_PRESERVE
|
&& pdbc->cb_commit != SQL_CB_PRESERVE
|
||||||
&& pdbc->cb_rollback != SQL_CB_PRESERVE )
|
&& pdbc->cb_rollback != SQL_CB_PRESERVE)
|
||||||
{
|
{
|
||||||
pstmt->state = en_stmt_allocated;
|
pstmt->state = en_stmt_allocated;
|
||||||
pstmt->prep_state = 0;
|
pstmt->prep_state = 0;
|
||||||
@@ -717,10 +722,10 @@ static RETCODE _iodbcdm_transact(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pstmt->prep_state )
|
if (pstmt->prep_state)
|
||||||
{
|
{
|
||||||
if( pdbc->cb_commit == SQL_CB_DELETE
|
if (pdbc->cb_commit == SQL_CB_DELETE
|
||||||
|| pdbc->cb_rollback== SQL_CB_DELETE )
|
|| pdbc->cb_rollback == SQL_CB_DELETE)
|
||||||
{
|
{
|
||||||
pstmt->state = en_stmt_allocated;
|
pstmt->state = en_stmt_allocated;
|
||||||
pstmt->prep_state = 0;
|
pstmt->prep_state = 0;
|
||||||
@@ -728,8 +733,8 @@ static RETCODE _iodbcdm_transact(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdbc->cb_commit == SQL_CB_CLOSE
|
if (pdbc->cb_commit == SQL_CB_CLOSE
|
||||||
|| pdbc->cb_rollback== SQL_CB_CLOSE )
|
|| pdbc->cb_rollback == SQL_CB_CLOSE)
|
||||||
{
|
{
|
||||||
pstmt->state
|
pstmt->state
|
||||||
= en_stmt_prepared;
|
= en_stmt_prepared;
|
||||||
@@ -749,21 +754,23 @@ static RETCODE _iodbcdm_transact(
|
|||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETCODE SQL_API SQLTransact(
|
|
||||||
|
RETCODE SQL_API
|
||||||
|
SQLTransact (
|
||||||
HENV henv,
|
HENV henv,
|
||||||
HDBC hdbc,
|
HDBC hdbc,
|
||||||
UWORD fType )
|
UWORD fType)
|
||||||
{
|
{
|
||||||
GENV_t FAR* genv = (GENV_t FAR*)henv;
|
GENV_t FAR *genv = (GENV_t FAR *) henv;
|
||||||
DBC_t FAR* pdbc = (DBC_t FAR*)hdbc;
|
DBC_t FAR *pdbc = (DBC_t FAR *) hdbc;
|
||||||
HERR herr;
|
HERR herr;
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
|
|
||||||
if( hdbc != SQL_NULL_HDBC )
|
if (hdbc != SQL_NULL_HDBC)
|
||||||
{
|
{
|
||||||
herr = pdbc->herr;
|
herr = pdbc->herr;
|
||||||
}
|
}
|
||||||
else if( henv != SQL_NULL_HENV )
|
else if (henv != SQL_NULL_HENV)
|
||||||
{
|
{
|
||||||
herr = genv->herr;
|
herr = genv->herr;
|
||||||
}
|
}
|
||||||
@@ -773,30 +780,30 @@ RETCODE SQL_API SQLTransact(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* check argument */
|
/* check argument */
|
||||||
if( fType != SQL_COMMIT
|
if (fType != SQL_COMMIT
|
||||||
&& fType != SQL_ROLLBACK )
|
&& fType != SQL_ROLLBACK)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( herr, en_S1012 );
|
PUSHSQLERR (herr, en_S1012);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( hdbc != SQL_NULL_HDBC )
|
if (hdbc != SQL_NULL_HDBC)
|
||||||
{
|
{
|
||||||
retcode = _iodbcdm_transact( hdbc, fType );
|
retcode = _iodbcdm_transact (hdbc, fType);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for( pdbc = (DBC_t FAR*)(genv->hdbc);
|
for (pdbc = (DBC_t FAR *) (genv->hdbc);
|
||||||
pdbc != NULL;
|
pdbc != NULL;
|
||||||
pdbc = pdbc->next )
|
pdbc = pdbc->next)
|
||||||
{
|
{
|
||||||
retcode |= _iodbcdm_transact( hdbc, fType );
|
retcode |= _iodbcdm_transact (hdbc, fType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( retcode != SQL_SUCCESS
|
if (retcode != SQL_SUCCESS
|
||||||
&& retcode != SQL_SUCCESS_WITH_INFO )
|
&& retcode != SQL_SUCCESS_WITH_INFO)
|
||||||
{
|
{
|
||||||
/* fail on one of the connection */
|
/* fail on one of the connection */
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
|
|||||||
@@ -1,10 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* hdbc.h
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Data source connect object management functions
|
||||||
|
*
|
||||||
|
* The iODBC driver manager.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free
|
||||||
|
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
#ifndef _HDBC_H
|
#ifndef _HDBC_H
|
||||||
#define _HDBC_H
|
#define _HDBC_H
|
||||||
|
|
||||||
typedef struct DBC
|
typedef struct DBC
|
||||||
{
|
{
|
||||||
int type; /* must be 1st field */
|
int type; /* must be 1st field */
|
||||||
struct DBC FAR*
|
struct DBC FAR *
|
||||||
next;
|
next;
|
||||||
|
|
||||||
HENV genv; /* back point to global env object */
|
HENV genv; /* back point to global env object */
|
||||||
@@ -28,15 +53,16 @@ typedef struct DBC
|
|||||||
SWORD cb_commit;
|
SWORD cb_commit;
|
||||||
SWORD cb_rollback;
|
SWORD cb_rollback;
|
||||||
|
|
||||||
char FAR*
|
char FAR *
|
||||||
current_qualifier;
|
current_qualifier;
|
||||||
|
|
||||||
int trace; /* trace flag */
|
int trace; /* trace flag */
|
||||||
char FAR*
|
char FAR *
|
||||||
tfile;
|
tfile;
|
||||||
void FAR*
|
void FAR *
|
||||||
tstm; /* trace stream */
|
tstm; /* trace stream */
|
||||||
} DBC_t;
|
}
|
||||||
|
DBC_t;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Note:
|
* Note:
|
||||||
@@ -57,11 +83,11 @@ typedef struct DBC
|
|||||||
* SQLGetInfo() with fInfoType equals to SQL_DRIVER_HDBC.
|
* SQLGetInfo() with fInfoType equals to SQL_DRIVER_HDBC.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum {
|
enum
|
||||||
|
{
|
||||||
en_dbc_allocated,
|
en_dbc_allocated,
|
||||||
en_dbc_needdata,
|
en_dbc_needdata,
|
||||||
en_dbc_connected,
|
en_dbc_connected,
|
||||||
en_dbc_hstmt
|
en_dbc_hstmt
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,37 +1,49 @@
|
|||||||
/** Environment object managment functions
|
/*
|
||||||
|
* henv.c
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Environment object management functions
|
||||||
|
*
|
||||||
|
* The iODBC driver manager.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free
|
||||||
|
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
#include <config.h>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
#include <isql.h>
|
||||||
it under the terms of the GNU General Public License as published by
|
#include <isqlext.h>
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
#include <dlproc.h>
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
**/
|
|
||||||
|
|
||||||
#include <../iodbc/iodbc.h>
|
#include <herr.h>
|
||||||
|
#include <henv.h>
|
||||||
|
|
||||||
#include <../iodbc/isql.h>
|
#include <itrace.h>
|
||||||
#include <../iodbc/isqlext.h>
|
|
||||||
|
|
||||||
#include <../iodbc/dlproc.h>
|
RETCODE SQL_API
|
||||||
|
SQLAllocEnv (HENV FAR * phenv)
|
||||||
#include <../iodbc/herr.h>
|
|
||||||
#include <../iodbc/henv.h>
|
|
||||||
|
|
||||||
#include <../iodbc/itrace.h>
|
|
||||||
|
|
||||||
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 )
|
if (genv == NULL)
|
||||||
{
|
{
|
||||||
*phenv = SQL_NULL_HENV;
|
*phenv = SQL_NULL_HENV;
|
||||||
|
|
||||||
@@ -46,30 +58,32 @@ RETCODE SQL_API SQLAllocEnv( HENV FAR* phenv )
|
|||||||
genv->hdbc = SQL_NULL_HDBC; /* driver's dbc list */
|
genv->hdbc = SQL_NULL_HDBC; /* driver's dbc list */
|
||||||
genv->herr = SQL_NULL_HERR; /* err 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 )
|
|
||||||
{
|
|
||||||
GENV_t FAR* genv = (GENV_t*)henv;
|
|
||||||
|
|
||||||
if( henv == SQL_NULL_HENV )
|
RETCODE SQL_API
|
||||||
|
SQLFreeEnv (HENV henv)
|
||||||
|
{
|
||||||
|
GENV_t FAR *genv = (GENV_t *) henv;
|
||||||
|
|
||||||
|
if (henv == SQL_NULL_HENV)
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( genv->hdbc != SQL_NULL_HDBC )
|
if (genv->hdbc != SQL_NULL_HDBC)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( genv->herr, en_S1010 );
|
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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,49 @@
|
|||||||
#ifndef CLI_NAME_PREFIX
|
/*
|
||||||
|
* henv.ci
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Function names
|
||||||
|
*
|
||||||
|
* The iODBC driver manager.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free
|
||||||
|
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
/* There are some exceptions :
|
/* There are some exceptions :
|
||||||
* on FreeBSD 2.x CLI_NAME_PREFIX is defined in Config.mk as "_SQL"
|
* 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 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 AIX 3.x 4.x, CLI_NAME_PREFIX is defined in Config.mk as ".SQL"
|
||||||
*/
|
*/
|
||||||
|
#ifndef CLI_NAME_PREFIX
|
||||||
# define CLI_NAME_PREFIX "SQL" /* using call by value prefix */
|
# define CLI_NAME_PREFIX "SQL" /* using call by value prefix */
|
||||||
|
#else
|
||||||
|
# ifdef NEED_USCORE
|
||||||
|
# define CLI_NAME_PREFIX "_SQL"
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static struct {
|
static struct
|
||||||
|
{
|
||||||
int en_idx;
|
int en_idx;
|
||||||
char* symbol;
|
char *symbol;
|
||||||
} odbcapi_symtab[] = {
|
}
|
||||||
|
odbcapi_symtab[] = {
|
||||||
|
|
||||||
#if (ODBCVER >= 0x0300)
|
#if (ODBCVER >= 0x0300)
|
||||||
{ en_AllocHandle CLI_NAME_PREFIX "AllocHandle" },
|
{ en_AllocHandle CLI_NAME_PREFIX "AllocHandle" },
|
||||||
{ en_FreeHandle CLI_NAME_PREFIX "FreeHandle" },
|
{ en_FreeHandle CLI_NAME_PREFIX "FreeHandle" },
|
||||||
|
|||||||
@@ -1,17 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* henv.h
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Environment object management functions
|
||||||
|
*
|
||||||
|
* The iODBC driver manager.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free
|
||||||
|
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
#ifndef _HENV_H
|
#ifndef _HENV_H
|
||||||
#define _HENV_H
|
#define _HENV_H
|
||||||
|
|
||||||
# include "config.h"
|
#include <config.h>
|
||||||
# include <dlproc.h>
|
#include <dlproc.h>
|
||||||
|
|
||||||
# include <isql.h>
|
#include <isql.h>
|
||||||
# include <isqlext.h>
|
#include <isqlext.h>
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
|
||||||
enum {
|
|
||||||
#if (ODBCVER >= 0x0300)
|
#if (ODBCVER >= 0x0300)
|
||||||
en_AllocHandle = SQL_API_SQLALLOCHANDLE,
|
en_AllocHandle = SQL_API_SQLALLOCHANDLE,
|
||||||
en_FreeHandle = SQL_API_SQLFREEHANDLE,
|
en_FreeHandle = SQL_API_SQLFREEHANDLE,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
en_AllocEnv = SQL_API_SQLALLOCENV,
|
en_AllocEnv = SQL_API_SQLALLOCENV,
|
||||||
en_AllocConnect = SQL_API_SQLALLOCCONNECT,
|
en_AllocConnect = SQL_API_SQLALLOCCONNECT,
|
||||||
en_Connect = SQL_API_SQLCONNECT,
|
en_Connect = SQL_API_SQLCONNECT,
|
||||||
@@ -78,28 +106,32 @@ enum {
|
|||||||
en_FreeEnv = SQL_API_SQLFREEENV,
|
en_FreeEnv = SQL_API_SQLFREEENV,
|
||||||
|
|
||||||
en_NullProc = SYSERR
|
en_NullProc = SYSERR
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct
|
||||||
|
{
|
||||||
int type; /* must be 1st field */
|
int type; /* must be 1st field */
|
||||||
|
|
||||||
HENV henv; /* driver's env list */
|
HENV henv; /* driver's env list */
|
||||||
HDBC hdbc; /* driver's dbc list */
|
HDBC hdbc; /* driver's dbc list */
|
||||||
HERR herr; /* err list */
|
HERR herr; /* err list */
|
||||||
int state;
|
int state;
|
||||||
} GENV_t;
|
}
|
||||||
|
GENV_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct
|
||||||
|
{
|
||||||
HENV next; /* next attached env handle */
|
HENV next; /* next attached env handle */
|
||||||
int refcount; /* Driver's bookkeeping reference count */
|
int refcount; /* Driver's bookkeeping reference count */
|
||||||
HPROC dllproc_tab[SQL_EXT_API_LAST + 1]; /* driver api calls */
|
HPROC dllproc_tab[SQL_EXT_API_LAST + 1]; /* driver api calls */
|
||||||
|
|
||||||
HENV dhenv; /* driver env handle */
|
HENV dhenv; /* driver env handle */
|
||||||
HDLL hdll; /* driver share library handle */
|
HDLL hdll; /* drvier share library handle */
|
||||||
} ENV_t;
|
}
|
||||||
|
ENV_t;
|
||||||
|
|
||||||
/* Note:
|
/* 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
|
* a void pointer points to a GENV_t object. There is only one
|
||||||
* this object per process(however, to make the library reentrant,
|
* this object per process(however, to make the library reentrant,
|
||||||
@@ -121,5 +153,4 @@ typedef struct {
|
|||||||
* - Applications can get driver's environment object handle by
|
* - Applications can get driver's environment object handle by
|
||||||
* SQLGetInfo() with fInfoType equals to SQL_DRIVER_HENV
|
* SQLGetInfo() with fInfoType equals to SQL_DRIVER_HENV
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
272
src/iodbc/herr.c
272
src/iodbc/herr.c
@@ -1,42 +1,52 @@
|
|||||||
/** Error stack management functions
|
/*
|
||||||
|
* herr.c
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Error stack management functions
|
||||||
|
*
|
||||||
|
* The iODBC driver manager.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free
|
||||||
|
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
#include <config.h>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
#include <isql.h>
|
||||||
it under the terms of the GNU General Public License as published by
|
#include <isqlext.h>
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
#include <dlproc.h>
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
**/
|
|
||||||
|
|
||||||
#include <../iodbc/iodbc.h>
|
#include <herr.h>
|
||||||
|
#include <henv.h>
|
||||||
|
#include <hdbc.h>
|
||||||
|
#include <hstmt.h>
|
||||||
|
|
||||||
#include <../iodbc/isql.h>
|
#include <itrace.h>
|
||||||
#include <../iodbc/isqlext.h>
|
|
||||||
|
|
||||||
#include <../iodbc/dlproc.h>
|
#include "herr.ci"
|
||||||
|
|
||||||
#include <../iodbc/herr.h>
|
static HERR
|
||||||
#include <../iodbc/henv.h>
|
_iodbcdm_popsqlerr (HERR herr)
|
||||||
#include <../iodbc/hdbc.h>
|
|
||||||
#include <../iodbc/hstmt.h>
|
|
||||||
|
|
||||||
#include <../iodbc/itrace.h>
|
|
||||||
|
|
||||||
#include "../iodbc/herr.ci"
|
|
||||||
#include <strings.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
static HERR _iodbcdm_popsqlerr( HERR herr )
|
|
||||||
{
|
{
|
||||||
sqlerr_t* list = (sqlerr_t*)herr;
|
sqlerr_t *list = (sqlerr_t *) herr;
|
||||||
sqlerr_t* next;
|
sqlerr_t *next;
|
||||||
|
|
||||||
if( herr == SQL_NULL_HERR )
|
if (herr == SQL_NULL_HERR)
|
||||||
{
|
{
|
||||||
return herr;
|
return herr;
|
||||||
}
|
}
|
||||||
@@ -48,31 +58,35 @@ static HERR _iodbcdm_popsqlerr( HERR herr )
|
|||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _iodbcdm_freesqlerrlist( HERR herrlist )
|
|
||||||
|
void
|
||||||
|
_iodbcdm_freesqlerrlist (HERR herrlist)
|
||||||
{
|
{
|
||||||
HERR list;
|
HERR list;
|
||||||
|
|
||||||
for(list = herrlist; list!= 0; )
|
for (list = herrlist; list != 0;)
|
||||||
{
|
{
|
||||||
list = _iodbcdm_popsqlerr(list);
|
list = _iodbcdm_popsqlerr (list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HERR _iodbcdm_pushsqlerr (
|
|
||||||
|
HERR
|
||||||
|
_iodbcdm_pushsqlerr (
|
||||||
HERR herr,
|
HERR herr,
|
||||||
sqlstcode_t code,
|
sqlstcode_t code,
|
||||||
char* msg )
|
char *msg)
|
||||||
{
|
{
|
||||||
sqlerr_t* ebuf;
|
sqlerr_t *ebuf;
|
||||||
sqlerr_t* perr = (sqlerr_t*)herr;
|
sqlerr_t *perr = (sqlerr_t *) herr;
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
|
|
||||||
if(herr != SQL_NULL_HERR )
|
if (herr != SQL_NULL_HERR)
|
||||||
{
|
{
|
||||||
idx = perr->idx + 1;
|
idx = perr->idx + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( idx == 64 )
|
if (idx == 64)
|
||||||
/* over wirte the top entry to prevent error stack blow out */
|
/* over wirte the top entry to prevent error stack blow out */
|
||||||
{
|
{
|
||||||
perr->code = code;
|
perr->code = code;
|
||||||
@@ -81,9 +95,9 @@ HERR _iodbcdm_pushsqlerr (
|
|||||||
return herr;
|
return herr;
|
||||||
}
|
}
|
||||||
|
|
||||||
ebuf = (sqlerr_t*)MEM_ALLOC (sizeof(sqlerr_t));
|
ebuf = (sqlerr_t *) MEM_ALLOC (sizeof (sqlerr_t));
|
||||||
|
|
||||||
if( ebuf == NULL )
|
if (ebuf == NULL)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -91,84 +105,90 @@ HERR _iodbcdm_pushsqlerr (
|
|||||||
ebuf->msg = msg;
|
ebuf->msg = msg;
|
||||||
ebuf->code = code;
|
ebuf->code = code;
|
||||||
ebuf->idx = idx;
|
ebuf->idx = idx;
|
||||||
ebuf->next = (sqlerr_t*)herr;
|
ebuf->next = (sqlerr_t *) herr;
|
||||||
|
|
||||||
return (HERR)ebuf;
|
return (HERR) ebuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
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 )
|
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;
|
return (char FAR *) NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( ptr = tab;
|
for (ptr = tab;
|
||||||
ptr->code != en_sqlstat_total;
|
ptr->code != en_sqlstat_total;
|
||||||
ptr++ )
|
ptr++)
|
||||||
{
|
{
|
||||||
if(ptr->code == perr->code)
|
if (ptr->code == perr->code)
|
||||||
{
|
{
|
||||||
return (char FAR*)(ptr->stat);
|
return (char FAR *) (ptr->stat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (char FAR*)NULL;
|
return (char FAR *) NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char FAR* _iodbcdm_getsqlerrmsg(
|
|
||||||
|
static char FAR *
|
||||||
|
_iodbcdm_getsqlerrmsg (
|
||||||
HERR herr,
|
HERR herr,
|
||||||
void FAR* errtab )
|
void FAR * errtab)
|
||||||
{
|
{
|
||||||
sqlerr_t* perr = (sqlerr_t*)herr;
|
sqlerr_t *perr = (sqlerr_t *) herr;
|
||||||
sqlerrmsg_t* ptr;
|
sqlerrmsg_t *ptr;
|
||||||
|
|
||||||
if( herr == SQL_NULL_HERR )
|
if (herr == SQL_NULL_HERR)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( perr->msg == NULL && errtab == NULL )
|
if (perr->msg == NULL && errtab == NULL)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( perr->msg != NULL )
|
if (perr->msg != NULL)
|
||||||
{
|
{
|
||||||
return perr->msg;
|
return perr->msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( ptr = (sqlerrmsg_t*)errtab;
|
for (ptr = (sqlerrmsg_t *) errtab;
|
||||||
ptr->code != en_sqlstat_total;
|
ptr->code != en_sqlstat_total;
|
||||||
ptr++ )
|
ptr++)
|
||||||
{
|
{
|
||||||
if( ptr->code == perr->code )
|
if (ptr->code == perr->code)
|
||||||
{
|
{
|
||||||
return (char FAR*)ptr->msg;
|
return (char FAR *) ptr->msg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (char FAR*)NULL;
|
return (char FAR *) NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETCODE SQL_API SQLError (
|
|
||||||
|
RETCODE SQL_API
|
||||||
|
SQLError (
|
||||||
HENV henv,
|
HENV henv,
|
||||||
HDBC hdbc,
|
HDBC hdbc,
|
||||||
HSTMT hstmt,
|
HSTMT hstmt,
|
||||||
UCHAR FAR* szSqlstate,
|
UCHAR FAR * szSqlstate,
|
||||||
SDWORD FAR* pfNativeError,
|
SDWORD FAR * pfNativeError,
|
||||||
UCHAR FAR* szErrorMsg,
|
UCHAR FAR * szErrorMsg,
|
||||||
SWORD cbErrorMsgMax,
|
SWORD cbErrorMsgMax,
|
||||||
SWORD FAR* pcbErrorMsg )
|
SWORD FAR * pcbErrorMsg)
|
||||||
{
|
{
|
||||||
GENV_t FAR* genv = (GENV_t FAR*) henv;
|
GENV_t FAR *genv = (GENV_t FAR *) henv;
|
||||||
DBC_t FAR* pdbc = (DBC_t FAR*) hdbc;
|
DBC_t FAR *pdbc = (DBC_t FAR *) hdbc;
|
||||||
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
STMT_t FAR *pstmt = (STMT_t FAR *) hstmt;
|
||||||
HDBC thdbc;
|
HDBC thdbc;
|
||||||
|
|
||||||
HENV dhenv = SQL_NULL_HENV;
|
HENV dhenv = SQL_NULL_HENV;
|
||||||
@@ -178,51 +198,51 @@ RETCODE SQL_API SQLError (
|
|||||||
HERR herr = SQL_NULL_HERR;
|
HERR herr = SQL_NULL_HERR;
|
||||||
HPROC hproc = SQL_NULL_HPROC;
|
HPROC hproc = SQL_NULL_HPROC;
|
||||||
|
|
||||||
char FAR* errmsg = NULL;
|
char FAR *errmsg = NULL;
|
||||||
char FAR* ststr = NULL;
|
char FAR *ststr = NULL;
|
||||||
|
|
||||||
int handle = 0;
|
int handle = 0;
|
||||||
RETCODE retcode = SQL_SUCCESS;
|
RETCODE retcode = SQL_SUCCESS;
|
||||||
|
|
||||||
if( hstmt != SQL_NULL_HSTMT ) /* retrive stmt err */
|
if (hstmt != SQL_NULL_HSTMT) /* retrive stmt err */
|
||||||
{
|
{
|
||||||
herr = pstmt->herr;
|
herr = pstmt->herr;
|
||||||
thdbc = pstmt->hdbc;
|
thdbc = pstmt->hdbc;
|
||||||
|
|
||||||
if( thdbc == SQL_NULL_HDBC )
|
if (thdbc == SQL_NULL_HDBC)
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
hproc = _iodbcdm_getproc( thdbc, en_Error );
|
hproc = _iodbcdm_getproc (thdbc, en_Error);
|
||||||
dhstmt = pstmt->dhstmt;
|
dhstmt = pstmt->dhstmt;
|
||||||
handle = 3;
|
handle = 3;
|
||||||
}
|
}
|
||||||
else if( hdbc != SQL_NULL_HDBC ) /* retrive dbc err */
|
else if (hdbc != SQL_NULL_HDBC) /* retrive dbc err */
|
||||||
{
|
{
|
||||||
herr = pdbc->herr;
|
herr = pdbc->herr;
|
||||||
thdbc = hdbc;
|
thdbc = hdbc;
|
||||||
if( thdbc == SQL_NULL_HDBC )
|
if (thdbc == SQL_NULL_HDBC)
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
hproc = _iodbcdm_getproc( thdbc, en_Error );
|
hproc = _iodbcdm_getproc (thdbc, en_Error);
|
||||||
dhdbc = pdbc->dhdbc;
|
dhdbc = pdbc->dhdbc;
|
||||||
handle = 2;
|
handle = 2;
|
||||||
|
|
||||||
if( herr == SQL_NULL_HERR
|
if (herr == SQL_NULL_HERR
|
||||||
&& pdbc->henv == SQL_NULL_HENV )
|
&& pdbc->henv == SQL_NULL_HENV)
|
||||||
{
|
{
|
||||||
return SQL_NO_DATA_FOUND;
|
return SQL_NO_DATA_FOUND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( henv != SQL_NULL_HENV ) /* retrive env err */
|
else if (henv != SQL_NULL_HENV) /* retrive env err */
|
||||||
{
|
{
|
||||||
herr = genv->herr;
|
herr = genv->herr;
|
||||||
|
|
||||||
/* Drivers shouldn't push error message
|
/* Drivers shouldn't push error message
|
||||||
* on envoriment handle */
|
* on envoriment handle */
|
||||||
|
|
||||||
if( herr == SQL_NULL_HERR )
|
if (herr == SQL_NULL_HERR)
|
||||||
{
|
{
|
||||||
return SQL_NO_DATA_FOUND;
|
return SQL_NO_DATA_FOUND;
|
||||||
}
|
}
|
||||||
@@ -234,58 +254,51 @@ RETCODE SQL_API SQLError (
|
|||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( szErrorMsg != NULL )
|
if (szErrorMsg != NULL)
|
||||||
{
|
{
|
||||||
if( cbErrorMsgMax < 0
|
if (cbErrorMsgMax < 0
|
||||||
|| cbErrorMsgMax > SQL_MAX_MESSAGE_LENGTH - 1 )
|
|| cbErrorMsgMax > SQL_MAX_MESSAGE_LENGTH - 1)
|
||||||
{
|
{
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
/* SQLError() doesn't post error for itself */
|
/* SQLError() doesn't post error for itself */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( herr == SQL_NULL_HERR ) /* no err on drv mng */
|
if (herr == SQL_NULL_HERR) /* no err on drv mng */
|
||||||
{
|
{
|
||||||
/* call driver */
|
/* call driver */
|
||||||
if( hproc == SQL_NULL_HPROC )
|
if (hproc == SQL_NULL_HPROC)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( herr, en_IM001 );
|
PUSHSQLERR (herr, en_IM001);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
CALL_DRIVER ( thdbc, retcode, hproc, en_Error, (
|
CALL_DRIVER (thdbc, retcode, hproc, en_Error,
|
||||||
dhenv, dhdbc, dhstmt,
|
(dhenv, dhdbc, dhstmt, szSqlstate, pfNativeError, szErrorMsg,
|
||||||
szSqlstate, pfNativeError,
|
cbErrorMsgMax, pcbErrorMsg))
|
||||||
szErrorMsg, cbErrorMsgMax, pcbErrorMsg) )
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
retcode = hproc(dhenv, dhdbc, dhstmt,
|
|
||||||
szSqlstate, pfNativeError,
|
|
||||||
szErrorMsg, cbErrorMsgMax, pcbErrorMsg);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( szSqlstate != NULL )
|
if (szSqlstate != NULL)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
/* get sql state string */
|
/* get sql state string */
|
||||||
ststr = (char FAR*)_iodbcdm_getsqlstate( herr,
|
ststr = (char FAR *) _iodbcdm_getsqlstate (herr,
|
||||||
(void FAR*)sqlerrmsg_tab );
|
(void FAR *) sqlerrmsg_tab);
|
||||||
|
|
||||||
if( ststr == NULL)
|
if (ststr == NULL)
|
||||||
{
|
{
|
||||||
len = 0;
|
len = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
len = (int)STRLEN(ststr);
|
len = (int) STRLEN (ststr);
|
||||||
}
|
}
|
||||||
|
|
||||||
STRNCPY ( szSqlstate, ststr, len );
|
STRNCPY (szSqlstate, ststr, len);
|
||||||
szSqlstate[len] = 0;
|
szSqlstate[len] = 0;
|
||||||
/* buffer size of szSqlstate is not checked. Applications
|
/* buffer size of szSqlstate is not checked. Applications
|
||||||
* suppose provide enough ( not less than 6 bytes ) buffer
|
* suppose provide enough ( not less than 6 bytes ) buffer
|
||||||
@@ -293,38 +306,37 @@ RETCODE SQL_API SQLError (
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pfNativeError != NULL )
|
if (pfNativeError != NULL)
|
||||||
{
|
{
|
||||||
/* native error code is specific to data source */
|
/* native error code is specific to data source */
|
||||||
*pfNativeError = (SDWORD)0L;
|
*pfNativeError = (SDWORD) 0L;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( szErrorMsg == NULL || cbErrorMsgMax == 0 )
|
if (szErrorMsg == NULL || cbErrorMsgMax == 0)
|
||||||
{
|
{
|
||||||
if( pcbErrorMsg != NULL )
|
if (pcbErrorMsg != NULL)
|
||||||
{
|
{
|
||||||
*pcbErrorMsg = (SWORD)0;
|
*pcbErrorMsg = (SWORD) 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
char msgbuf[256] = { '\0' };
|
char msgbuf[256] = {'\0'};
|
||||||
|
|
||||||
/* get sql state message */
|
/* get sql state message */
|
||||||
errmsg = _iodbcdm_getsqlerrmsg(herr,
|
errmsg = _iodbcdm_getsqlerrmsg (herr, (void FAR *) sqlerrmsg_tab);
|
||||||
(void FAR*)sqlerrmsg_tab);
|
|
||||||
|
|
||||||
if(errmsg == NULL)
|
if (errmsg == NULL)
|
||||||
{
|
{
|
||||||
errmsg = (char FAR*)"";
|
errmsg = (char FAR *) "";
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(msgbuf, "%s%s", sqlerrhd, errmsg);
|
sprintf (msgbuf, "%s%s", sqlerrhd, errmsg);
|
||||||
|
|
||||||
len = STRLEN( msgbuf );
|
len = STRLEN (msgbuf);
|
||||||
|
|
||||||
if( len < cbErrorMsgMax - 1 )
|
if (len < cbErrorMsgMax - 1)
|
||||||
{
|
{
|
||||||
retcode = SQL_SUCCESS;
|
retcode = SQL_SUCCESS;
|
||||||
}
|
}
|
||||||
@@ -335,27 +347,27 @@ RETCODE SQL_API SQLError (
|
|||||||
/* and not posts error for itself */
|
/* and not posts error for itself */
|
||||||
}
|
}
|
||||||
|
|
||||||
STRNCPY((char*)szErrorMsg, msgbuf, len);
|
STRNCPY ((char *) szErrorMsg, msgbuf, len);
|
||||||
szErrorMsg[len] = 0;
|
szErrorMsg[len] = 0;
|
||||||
|
|
||||||
if( pcbErrorMsg != NULL)
|
if (pcbErrorMsg != NULL)
|
||||||
{
|
{
|
||||||
*pcbErrorMsg = (SWORD)len;
|
*pcbErrorMsg = (SWORD) len;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(handle) /* free this err */
|
switch (handle) /* free this err */
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
genv->herr = _iodbcdm_popsqlerr(genv->herr);
|
genv->herr = _iodbcdm_popsqlerr (genv->herr);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
pdbc->herr = _iodbcdm_popsqlerr(pdbc->herr);
|
pdbc->herr = _iodbcdm_popsqlerr (pdbc->herr);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
pstmt->herr= _iodbcdm_popsqlerr(pstmt->herr);
|
pstmt->herr = _iodbcdm_popsqlerr (pstmt->herr);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -1,3 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* herr.ci
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Error messages
|
||||||
|
*
|
||||||
|
* The iODBC driver manager.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free
|
||||||
|
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
static const sqlerrmsg_t sqlerrmsg_tab[] =
|
static const sqlerrmsg_t sqlerrmsg_tab[] =
|
||||||
{
|
{
|
||||||
{ en_00000, "00000", "" },
|
{ en_00000, "00000", "" },
|
||||||
|
|||||||
@@ -1,7 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* herr.h
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Error stack management functions
|
||||||
|
*
|
||||||
|
* The iODBC driver manager.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free
|
||||||
|
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
#ifndef _HERR_H
|
#ifndef _HERR_H
|
||||||
#define _HERR_H
|
#define _HERR_H
|
||||||
|
|
||||||
typedef enum {
|
typedef enum
|
||||||
|
{
|
||||||
en_00000 = 0,
|
en_00000 = 0,
|
||||||
en_01000,
|
en_01000,
|
||||||
en_01002,
|
en_01002,
|
||||||
@@ -94,32 +120,34 @@ typedef enum {
|
|||||||
en_S1C00,
|
en_S1C00,
|
||||||
en_S1T00,
|
en_S1T00,
|
||||||
en_sqlstat_total
|
en_sqlstat_total
|
||||||
} sqlstcode_t;
|
}
|
||||||
|
sqlstcode_t;
|
||||||
|
|
||||||
typedef void FAR* HERR;
|
typedef void FAR *HERR;
|
||||||
# define SQL_NULL_HERR ((HERR)NULL)
|
#define SQL_NULL_HERR ((HERR)NULL)
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
sqlstcode_t code;
|
sqlstcode_t code;
|
||||||
char FAR* stat;
|
char FAR *stat;
|
||||||
char FAR* msg;
|
char FAR *msg;
|
||||||
} sqlerrmsg_t;
|
}
|
||||||
|
sqlerrmsg_t;
|
||||||
|
|
||||||
typedef struct sqlerr {
|
typedef struct sqlerr
|
||||||
|
{
|
||||||
sqlstcode_t code;
|
sqlstcode_t code;
|
||||||
int idx;
|
int idx;
|
||||||
char FAR* msg;
|
char FAR *msg;
|
||||||
struct sqlerr* next;
|
struct sqlerr *next;
|
||||||
} sqlerr_t;
|
}
|
||||||
|
sqlerr_t;
|
||||||
|
|
||||||
extern void _iodbcdm_freesqlerrlist( HERR herr );
|
extern void _iodbcdm_freesqlerrlist (HERR herr);
|
||||||
extern HERR _iodbcdm_pushsqlerr ( HERR list, sqlstcode_t code, char* sysmsg );
|
extern HERR _iodbcdm_pushsqlerr (HERR list, sqlstcode_t code, char *sysmsg);
|
||||||
|
|
||||||
# define PUSHSYSERR(list, msg) \
|
#define PUSHSYSERR(list, msg) \
|
||||||
list = (HERR)_iodbcdm_pushsqlerr( (HERR)(list), 0, (char*)msg )
|
list = (HERR)_iodbcdm_pushsqlerr( (HERR)(list), 0, (char*)msg )
|
||||||
# define PUSHSQLERR(list, code) \
|
#define PUSHSQLERR(list, code) \
|
||||||
list = (HERR)_iodbcdm_pushsqlerr( (HERR)(list), (int)(code), NULL )
|
list = (HERR)_iodbcdm_pushsqlerr( (HERR)(list), (int)(code), NULL )
|
||||||
|
|
||||||
|
|
||||||
#endif /* _SQLERR_H */
|
#endif /* _SQLERR_H */
|
||||||
|
|||||||
@@ -1,60 +1,71 @@
|
|||||||
/** Query statement object management functions
|
/*
|
||||||
|
* hstmt.c
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Query statement object management functions
|
||||||
|
*
|
||||||
|
* The iODBC driver manager.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free
|
||||||
|
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
#include <config.h>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
#include <isql.h>
|
||||||
it under the terms of the GNU General Public License as published by
|
#include <isqlext.h>
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
#include <dlproc.h>
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
**/
|
|
||||||
|
|
||||||
#include <../iodbc/iodbc.h>
|
#include <herr.h>
|
||||||
|
#include <henv.h>
|
||||||
|
#include <hdbc.h>
|
||||||
|
#include <hstmt.h>
|
||||||
|
|
||||||
#include <../iodbc/isql.h>
|
#include <itrace.h>
|
||||||
#include <../iodbc/isqlext.h>
|
|
||||||
|
|
||||||
#include <../iodbc/dlproc.h>
|
RETCODE SQL_API
|
||||||
|
SQLAllocStmt (
|
||||||
#include <../iodbc/herr.h>
|
|
||||||
#include <../iodbc/henv.h>
|
|
||||||
#include <../iodbc/hdbc.h>
|
|
||||||
#include <../iodbc/hstmt.h>
|
|
||||||
|
|
||||||
#include <../iodbc/itrace.h>
|
|
||||||
|
|
||||||
RETCODE SQL_API SQLAllocStmt (
|
|
||||||
HDBC hdbc,
|
HDBC hdbc,
|
||||||
HSTMT FAR* phstmt )
|
HSTMT FAR * phstmt)
|
||||||
{
|
{
|
||||||
DBC_t FAR* pdbc = (DBC_t FAR*)hdbc;
|
DBC_t FAR *pdbc = (DBC_t FAR *) hdbc;
|
||||||
STMT_t FAR* pstmt = NULL;
|
STMT_t FAR *pstmt = NULL;
|
||||||
HPROC hproc = SQL_NULL_HPROC;
|
HPROC hproc = SQL_NULL_HPROC;
|
||||||
RETCODE retcode = SQL_SUCCESS;
|
RETCODE retcode = SQL_SUCCESS;
|
||||||
|
|
||||||
#if (ODBCVER >= 0x0300)
|
#if (ODBCVER >= 0x0300)
|
||||||
if( hdbc == SQL_NULL_HDBC
|
if (hdbc == SQL_NULL_HDBC || pdbc->type != SQL_HANDLE_DBC)
|
||||||
|| pdbc->type != SQL_HANDLE_DBC )
|
|
||||||
#else
|
#else
|
||||||
if( hdbc == SQL_NULL_HDBC )
|
if (hdbc == SQL_NULL_HDBC)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( phstmt == NULL )
|
if (phstmt == NULL)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pdbc->herr, en_S1009 );
|
PUSHSQLERR (pdbc->herr, en_S1009);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check state */
|
/* check state */
|
||||||
switch( pdbc->state )
|
switch (pdbc->state)
|
||||||
{
|
{
|
||||||
case en_dbc_connected:
|
case en_dbc_connected:
|
||||||
case en_dbc_hstmt:
|
case en_dbc_hstmt:
|
||||||
@@ -62,7 +73,7 @@ RETCODE SQL_API SQLAllocStmt (
|
|||||||
|
|
||||||
case en_dbc_allocated:
|
case en_dbc_allocated:
|
||||||
case en_dbc_needdata:
|
case en_dbc_needdata:
|
||||||
PUSHSQLERR ( pdbc->herr, en_08003 );
|
PUSHSQLERR (pdbc->herr, en_08003);
|
||||||
*phstmt = SQL_NULL_HSTMT;
|
*phstmt = SQL_NULL_HSTMT;
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
|
|
||||||
@@ -70,11 +81,11 @@ RETCODE SQL_API SQLAllocStmt (
|
|||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
pstmt = (STMT_t FAR*)MEM_ALLOC(sizeof(STMT_t));
|
pstmt = (STMT_t FAR *) MEM_ALLOC (sizeof (STMT_t));
|
||||||
|
|
||||||
if( pstmt == NULL )
|
if (pstmt == NULL)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pdbc->herr, en_S1001 );
|
PUSHSQLERR (pdbc->herr, en_S1001);
|
||||||
*phstmt = SQL_NULL_HSTMT;
|
*phstmt = SQL_NULL_HSTMT;
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
@@ -83,6 +94,7 @@ RETCODE SQL_API SQLAllocStmt (
|
|||||||
#if (ODBCVER >= 0x0300)
|
#if (ODBCVER >= 0x0300)
|
||||||
pstmt->type = SQL_HANDLE_STMT;
|
pstmt->type = SQL_HANDLE_STMT;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* initiate the object */
|
/* initiate the object */
|
||||||
pstmt->herr = SQL_NULL_HERR;
|
pstmt->herr = SQL_NULL_HERR;
|
||||||
pstmt->hdbc = hdbc;
|
pstmt->hdbc = hdbc;
|
||||||
@@ -93,40 +105,38 @@ RETCODE SQL_API SQLAllocStmt (
|
|||||||
pstmt->need_on = en_NullProc;
|
pstmt->need_on = en_NullProc;
|
||||||
|
|
||||||
/* call driver's function */
|
/* call driver's function */
|
||||||
#if (ODBCVER >= 0x0300)
|
|
||||||
hproc = _iodbcdm_getproc( hdbc, en_AllocHandle );
|
|
||||||
|
|
||||||
if( hproc )
|
#if (ODBCVER >= 0x0300)
|
||||||
|
hproc = _iodbcdm_getproc (hdbc, en_AllocHandle);
|
||||||
|
|
||||||
|
if (hproc)
|
||||||
{
|
{
|
||||||
CALL_DRIVER ( pstmt->hdbc, hdbc, retcode, hproc,
|
CALL_DRIVER (pstmt->hdbc, hdbc, retcode, hproc, en_AllocHandle,
|
||||||
en_AllocHandle, (
|
(SQL_HANDLE_STMT, pdbc->dhdbc, &(pstmt->dhstmt)))
|
||||||
SQL_HANDLE_STMT,
|
|
||||||
pdbc->dhdbc,
|
|
||||||
&(pstmt->dhstmt) ) )
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
|
||||||
hproc = _iodbcdm_getproc( hdbc, en_AllocStmt );
|
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
hproc = _iodbcdm_getproc (hdbc, en_AllocStmt);
|
||||||
|
|
||||||
|
if (hproc == SQL_NULL_HPROC)
|
||||||
|
{
|
||||||
|
PUSHSQLERR (pstmt->herr, en_IM001);
|
||||||
*phstmt = SQL_NULL_HSTMT;
|
*phstmt = SQL_NULL_HSTMT;
|
||||||
MEM_FREE ( pstmt );
|
MEM_FREE (pstmt);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
CALL_DRIVER ( hdbc, retcode, hproc, en_AllocStmt, (
|
CALL_DRIVER (hdbc, retcode, hproc, en_AllocStmt,
|
||||||
pdbc->dhdbc, &(pstmt->dhstmt) ) )
|
(pdbc->dhdbc, &(pstmt->dhstmt)))
|
||||||
}
|
}
|
||||||
|
|
||||||
if( retcode != SQL_SUCCESS
|
if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO)
|
||||||
&& retcode != SQL_SUCCESS_WITH_INFO )
|
|
||||||
{
|
{
|
||||||
*phstmt = SQL_NULL_HSTMT;
|
*phstmt = SQL_NULL_HSTMT;
|
||||||
MEM_FREE ( pstmt );
|
MEM_FREE (pstmt);
|
||||||
|
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
@@ -135,7 +145,7 @@ RETCODE SQL_API SQLAllocStmt (
|
|||||||
pstmt->next = pdbc->hstmt;
|
pstmt->next = pdbc->hstmt;
|
||||||
pdbc->hstmt = pstmt;
|
pdbc->hstmt = pstmt;
|
||||||
|
|
||||||
*phstmt = (HSTMT)pstmt;
|
*phstmt = (HSTMT) pstmt;
|
||||||
|
|
||||||
/* state transition */
|
/* state transition */
|
||||||
pdbc->state = en_dbc_hstmt;
|
pdbc->state = en_dbc_hstmt;
|
||||||
@@ -143,68 +153,71 @@ RETCODE SQL_API SQLAllocStmt (
|
|||||||
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 )
|
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;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
pdbc = (DBC_t FAR*)(pstmt->hdbc);
|
pdbc = (DBC_t FAR *) (pstmt->hdbc);
|
||||||
|
|
||||||
for(tpstmt = (STMT_t FAR*)pdbc->hstmt;
|
for (tpstmt = (STMT_t FAR *) pdbc->hstmt;
|
||||||
tpstmt != NULL;
|
tpstmt != NULL;
|
||||||
tpstmt = tpstmt->next )
|
tpstmt = tpstmt->next)
|
||||||
{
|
{
|
||||||
if(tpstmt == pstmt)
|
if (tpstmt == pstmt)
|
||||||
{
|
{
|
||||||
pdbc->hstmt = (HSTMT)pstmt->next;
|
pdbc->hstmt = (HSTMT) pstmt->next;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tpstmt->next == pstmt)
|
if (tpstmt->next == pstmt)
|
||||||
{
|
{
|
||||||
tpstmt->next = pstmt->next;
|
tpstmt->next = pstmt->next;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( tpstmt == NULL )
|
if (tpstmt == NULL)
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
_iodbcdm_freesqlerrlist(pstmt->herr);
|
_iodbcdm_freesqlerrlist (pstmt->herr);
|
||||||
MEM_FREE(hstmt);
|
MEM_FREE (hstmt);
|
||||||
|
|
||||||
return SQL_SUCCESS;
|
return SQL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETCODE SQL_API SQLFreeStmt (
|
|
||||||
|
RETCODE SQL_API
|
||||||
|
SQLFreeStmt (
|
||||||
HSTMT hstmt,
|
HSTMT hstmt,
|
||||||
UWORD fOption )
|
UWORD fOption)
|
||||||
{
|
{
|
||||||
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
STMT_t FAR *pstmt = (STMT_t FAR *) hstmt;
|
||||||
STMT_t FAR* tpstmt;
|
STMT_t FAR *tpstmt;
|
||||||
DBC_t FAR* pdbc;
|
DBC_t FAR *pdbc;
|
||||||
|
|
||||||
HPROC hproc = SQL_NULL_HPROC;
|
HPROC hproc = SQL_NULL_HPROC;
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
|
|
||||||
if( hstmt == SQL_NULL_HSTMT
|
if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC)
|
||||||
|| pstmt->hdbc == SQL_NULL_HDBC )
|
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
pdbc = (DBC_t FAR*)(pstmt->hdbc);
|
pdbc = (DBC_t FAR *) (pstmt->hdbc);
|
||||||
|
|
||||||
/* check option */
|
/* check option */
|
||||||
switch( fOption )
|
switch (fOption)
|
||||||
{
|
{
|
||||||
case SQL_DROP:
|
case SQL_DROP:
|
||||||
case SQL_CLOSE:
|
case SQL_CLOSE:
|
||||||
@@ -213,61 +226,60 @@ RETCODE SQL_API SQLFreeStmt (
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1092 );
|
PUSHSQLERR (pstmt->herr, en_S1092);
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check state */
|
/* check state */
|
||||||
if( pstmt->state >= en_stmt_needdata
|
if (pstmt->state >= en_stmt_needdata || pstmt->asyn_on != en_NullProc)
|
||||||
|| pstmt->asyn_on != en_NullProc )
|
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1010 );
|
PUSHSQLERR (pstmt->herr, en_S1010);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
hproc == SQL_NULL_HPROC;
|
hproc = SQL_NULL_HPROC;
|
||||||
|
|
||||||
#if (ODBCVER >= 0x0300)
|
#if (ODBCVER >= 0x0300)
|
||||||
if( fOption == SQL_DROP )
|
if (fOption == SQL_DROP)
|
||||||
{
|
{
|
||||||
hproc = _iodbcdm_getproc( pstmt->hdbc, en_FreeHandle );
|
hproc = _iodbcdm_getproc (pstmt->hdbc, en_FreeHandle);
|
||||||
|
|
||||||
if( hproc )
|
if (hproc)
|
||||||
{
|
{
|
||||||
CALL_DRIVER( pstmt->hdbc, retcode, hproc, en_FreeHandle, (
|
CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_FreeHandle,
|
||||||
SQL_HANDLE_STMT, pstmt->dhstmt )
|
(SQL_HANDLE_STMT, pstmt->dhstmt))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
if (hproc == SQL_NULL_HPROC)
|
||||||
{
|
{
|
||||||
hproc = _iodbcdm_getproc( pstmt->hdbc, en_FreeStmt);
|
hproc = _iodbcdm_getproc (pstmt->hdbc, en_FreeStmt);
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
if (hproc == SQL_NULL_HPROC)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
PUSHSQLERR (pstmt->herr, en_IM001);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_FreeStmt, (
|
CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_FreeStmt,
|
||||||
pstmt->dhstmt, fOption) )
|
(pstmt->dhstmt, fOption))
|
||||||
}
|
}
|
||||||
|
|
||||||
if( retcode != SQL_SUCCESS
|
if (retcode != SQL_SUCCESS
|
||||||
&& retcode != SQL_SUCCESS_WITH_INFO )
|
&& retcode != SQL_SUCCESS_WITH_INFO)
|
||||||
{
|
{
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* state transition */
|
/* state transition */
|
||||||
switch( fOption )
|
switch (fOption)
|
||||||
{
|
{
|
||||||
case SQL_DROP:
|
case SQL_DROP:
|
||||||
/* delet this object (ignore return) */
|
/* delet this object (ignore return) */
|
||||||
_iodbcdm_dropstmt( hstmt );
|
_iodbcdm_dropstmt (hstmt);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SQL_CLOSE:
|
case SQL_CLOSE:
|
||||||
@@ -277,7 +289,7 @@ RETCODE SQL_API SQLFreeStmt (
|
|||||||
* be erased.
|
* be erased.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
switch( pstmt->state )
|
switch (pstmt->state)
|
||||||
{
|
{
|
||||||
case en_stmt_allocated:
|
case en_stmt_allocated:
|
||||||
case en_stmt_prepared:
|
case en_stmt_prepared:
|
||||||
@@ -287,7 +299,7 @@ RETCODE SQL_API SQLFreeStmt (
|
|||||||
case en_stmt_cursoropen:
|
case en_stmt_cursoropen:
|
||||||
case en_stmt_fetched:
|
case en_stmt_fetched:
|
||||||
case en_stmt_xfetched:
|
case en_stmt_xfetched:
|
||||||
if( pstmt->prep_state )
|
if (pstmt->prep_state)
|
||||||
{
|
{
|
||||||
pstmt->state =
|
pstmt->state =
|
||||||
en_stmt_prepared;
|
en_stmt_prepared;
|
||||||
@@ -313,46 +325,47 @@ RETCODE SQL_API SQLFreeStmt (
|
|||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETCODE SQL_API SQLSetStmtOption (
|
|
||||||
|
RETCODE SQL_API
|
||||||
|
SQLSetStmtOption (
|
||||||
HSTMT hstmt,
|
HSTMT hstmt,
|
||||||
UWORD fOption,
|
UWORD fOption,
|
||||||
UDWORD vParam )
|
UDWORD vParam)
|
||||||
{
|
{
|
||||||
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
STMT_t FAR *pstmt = (STMT_t FAR *) hstmt;
|
||||||
HPROC hproc;
|
HPROC hproc;
|
||||||
int sqlstat = en_00000;
|
int sqlstat = en_00000;
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
|
|
||||||
if( hstmt == SQL_NULL_HSTMT
|
if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC)
|
||||||
|| pstmt->hdbc == SQL_NULL_HDBC )
|
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check option */
|
/* check option */
|
||||||
if(/* fOption < SQL_STMT_OPT_MIN || */
|
if ( /* fOption < SQL_STMT_OPT_MIN || */
|
||||||
fOption > SQL_STMT_OPT_MAX )
|
fOption > SQL_STMT_OPT_MAX)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1092 );
|
PUSHSQLERR (pstmt->herr, en_S1092);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( fOption == SQL_CONCURRENCY
|
if (fOption == SQL_CONCURRENCY
|
||||||
|| fOption == SQL_CURSOR_TYPE
|
|| fOption == SQL_CURSOR_TYPE
|
||||||
|| fOption == SQL_SIMULATE_CURSOR
|
|| fOption == SQL_SIMULATE_CURSOR
|
||||||
|| fOption == SQL_USE_BOOKMARKS )
|
|| fOption == SQL_USE_BOOKMARKS)
|
||||||
{
|
{
|
||||||
if( pstmt->asyn_on != en_NullProc )
|
if (pstmt->asyn_on != en_NullProc)
|
||||||
{
|
{
|
||||||
if( pstmt->prep_state )
|
if (pstmt->prep_state)
|
||||||
{
|
{
|
||||||
sqlstat = en_S1011;
|
sqlstat = en_S1011;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch( pstmt->state )
|
switch (pstmt->state)
|
||||||
{
|
{
|
||||||
case en_stmt_prepared:
|
case en_stmt_prepared:
|
||||||
sqlstat = en_S1011;
|
sqlstat = en_S1011;
|
||||||
@@ -368,7 +381,7 @@ RETCODE SQL_API SQLSetStmtOption (
|
|||||||
case en_stmt_needdata:
|
case en_stmt_needdata:
|
||||||
case en_stmt_mustput:
|
case en_stmt_mustput:
|
||||||
case en_stmt_canput:
|
case en_stmt_canput:
|
||||||
if( pstmt->prep_state )
|
if (pstmt->prep_state)
|
||||||
{
|
{
|
||||||
sqlstat = en_S1011;
|
sqlstat = en_S1011;
|
||||||
}
|
}
|
||||||
@@ -381,89 +394,85 @@ RETCODE SQL_API SQLSetStmtOption (
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( pstmt->asyn_on != en_NullProc )
|
if (pstmt->asyn_on != en_NullProc)
|
||||||
{
|
{
|
||||||
if( ! pstmt->prep_state )
|
if (!pstmt->prep_state)
|
||||||
{
|
{
|
||||||
sqlstat = en_S1010;
|
sqlstat = en_S1010;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( pstmt->state >= en_stmt_needdata )
|
if (pstmt->state >= en_stmt_needdata)
|
||||||
{
|
{
|
||||||
sqlstat = en_S1010;
|
sqlstat = en_S1010;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( sqlstat != en_00000 )
|
if (sqlstat != en_00000)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, sqlstat );
|
PUSHSQLERR (pstmt->herr, sqlstat);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
hproc = _iodbcdm_getproc( pstmt->hdbc, en_SetStmtOption );
|
hproc = _iodbcdm_getproc (pstmt->hdbc, en_SetStmtOption);
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
if (hproc == SQL_NULL_HPROC)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
PUSHSQLERR (pstmt->herr, en_IM001);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_SetStmtOption, (
|
CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_SetStmtOption,
|
||||||
pstmt->dhstmt, fOption, vParam ) )
|
(pstmt->dhstmt, fOption, vParam))
|
||||||
|
|
||||||
#if 0
|
|
||||||
retcode = hproc ( pstmt->dhstmt, fOption, vParam );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETCODE SQL_API SQLGetStmtOption (
|
|
||||||
|
RETCODE SQL_API
|
||||||
|
SQLGetStmtOption (
|
||||||
HSTMT hstmt,
|
HSTMT hstmt,
|
||||||
UWORD fOption,
|
UWORD fOption,
|
||||||
PTR pvParam )
|
PTR pvParam)
|
||||||
{
|
{
|
||||||
STMT_t FAR* pstmt = (STMT_t*)hstmt;
|
STMT_t FAR *pstmt = (STMT_t *) hstmt;
|
||||||
HPROC hproc;
|
HPROC hproc;
|
||||||
int sqlstat = en_00000;
|
int sqlstat = en_00000;
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
|
|
||||||
if( hstmt == SQL_NULL_HSTMT
|
if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC)
|
||||||
|| pstmt->hdbc == SQL_NULL_HDBC )
|
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check option */
|
/* check option */
|
||||||
if( /* fOption < SQL_STMT_OPT_MIN || */
|
if ( /* fOption < SQL_STMT_OPT_MIN || */
|
||||||
fOption > SQL_STMT_OPT_MAX )
|
fOption > SQL_STMT_OPT_MAX)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1092 );
|
PUSHSQLERR (pstmt->herr, en_S1092);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check state */
|
/* check state */
|
||||||
if( pstmt->state >= en_stmt_needdata
|
if (pstmt->state >= en_stmt_needdata
|
||||||
|| pstmt->asyn_on != en_NullProc )
|
|| pstmt->asyn_on != en_NullProc)
|
||||||
{
|
{
|
||||||
sqlstat = en_S1010;
|
sqlstat = en_S1010;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch( pstmt->state )
|
switch (pstmt->state)
|
||||||
{
|
{
|
||||||
case en_stmt_allocated:
|
case en_stmt_allocated:
|
||||||
case en_stmt_prepared:
|
case en_stmt_prepared:
|
||||||
case en_stmt_executed:
|
case en_stmt_executed:
|
||||||
case en_stmt_cursoropen:
|
case en_stmt_cursoropen:
|
||||||
if( fOption == SQL_ROW_NUMBER
|
if (fOption == SQL_ROW_NUMBER || fOption == SQL_GET_BOOKMARK)
|
||||||
|| fOption == SQL_GET_BOOKMARK )
|
|
||||||
{
|
{
|
||||||
sqlstat = en_24000;
|
sqlstat = en_24000;
|
||||||
}
|
}
|
||||||
@@ -474,39 +483,36 @@ RETCODE SQL_API SQLGetStmtOption (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( sqlstat != en_00000 )
|
if (sqlstat != en_00000)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, sqlstat );
|
PUSHSQLERR (pstmt->herr, sqlstat);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
hproc = _iodbcdm_getproc( pstmt->hdbc, en_GetStmtOption);
|
hproc = _iodbcdm_getproc (pstmt->hdbc, en_GetStmtOption);
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
if (hproc == SQL_NULL_HPROC)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
PUSHSQLERR (pstmt->herr, en_IM001);
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_GetStmtOption, (
|
CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_GetStmtOption,
|
||||||
pstmt->dhstmt, fOption, pvParam ) )
|
(pstmt->dhstmt, fOption, pvParam))
|
||||||
|
|
||||||
#if 0
|
|
||||||
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;
|
STMT_t FAR *pstmt = (STMT_t FAR *) hstmt;
|
||||||
HPROC hproc;
|
HPROC hproc;
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
|
|
||||||
if( hstmt == SQL_NULL_HSTMT
|
if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC)
|
||||||
|| pstmt->hdbc == SQL_NULL_HDBC )
|
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
@@ -515,36 +521,32 @@ RETCODE SQL_API SQLCancel ( HSTMT hstmt )
|
|||||||
/* check state */
|
/* check state */
|
||||||
|
|
||||||
/* call driver */
|
/* call driver */
|
||||||
hproc = _iodbcdm_getproc( pstmt->hdbc, en_Cancel );
|
hproc = _iodbcdm_getproc (pstmt->hdbc, en_Cancel);
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
if (hproc == SQL_NULL_HPROC)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
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 );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* state transition */
|
/* state transition */
|
||||||
if( retcode != SQL_SUCCESS
|
if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO)
|
||||||
&& retcode != SQL_SUCCESS_WITH_INFO )
|
|
||||||
{
|
{
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( pstmt->state )
|
switch (pstmt->state)
|
||||||
{
|
{
|
||||||
case en_stmt_allocated:
|
case en_stmt_allocated:
|
||||||
case en_stmt_prepared:
|
case en_stmt_prepared:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case en_stmt_executed:
|
case en_stmt_executed:
|
||||||
if( pstmt->prep_state )
|
if (pstmt->prep_state)
|
||||||
{
|
{
|
||||||
pstmt->state = en_stmt_prepared;
|
pstmt->state = en_stmt_prepared;
|
||||||
}
|
}
|
||||||
@@ -557,7 +559,7 @@ RETCODE SQL_API SQLCancel ( HSTMT hstmt )
|
|||||||
case en_stmt_cursoropen:
|
case en_stmt_cursoropen:
|
||||||
case en_stmt_fetched:
|
case en_stmt_fetched:
|
||||||
case en_stmt_xfetched:
|
case en_stmt_xfetched:
|
||||||
if( pstmt->prep_state )
|
if (pstmt->prep_state)
|
||||||
{
|
{
|
||||||
pstmt->state = en_stmt_prepared;
|
pstmt->state = en_stmt_prepared;
|
||||||
}
|
}
|
||||||
@@ -570,7 +572,7 @@ RETCODE SQL_API SQLCancel ( HSTMT hstmt )
|
|||||||
case en_stmt_needdata:
|
case en_stmt_needdata:
|
||||||
case en_stmt_mustput:
|
case en_stmt_mustput:
|
||||||
case en_stmt_canput:
|
case en_stmt_canput:
|
||||||
switch( pstmt->need_on )
|
switch (pstmt->need_on)
|
||||||
{
|
{
|
||||||
case en_ExecDirect:
|
case en_ExecDirect:
|
||||||
pstmt->state = en_stmt_allocated;
|
pstmt->state = en_stmt_allocated;
|
||||||
|
|||||||
@@ -1,3 +1,28 @@
|
|||||||
|
/*
|
||||||
|
* hstmt.h
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Query statement object management functions
|
||||||
|
*
|
||||||
|
* The iODBC driver manager.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free
|
||||||
|
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
#ifndef _HSTMT_H
|
#ifndef _HSTMT_H
|
||||||
#define _HSTMT_H
|
#define _HSTMT_H
|
||||||
|
|
||||||
@@ -7,10 +32,10 @@
|
|||||||
#include <isqlext.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;
|
HERR herr;
|
||||||
HDBC hdbc; /* back point to connection object */
|
HDBC hdbc; /* back point to connection object */
|
||||||
@@ -21,9 +46,11 @@ typedef struct STMT
|
|||||||
int prep_state;
|
int prep_state;
|
||||||
int asyn_on; /* async executing which odbc call */
|
int asyn_on; /* async executing which odbc call */
|
||||||
int need_on; /* which call return SQL_NEED_DATA */
|
int need_on; /* which call return SQL_NEED_DATA */
|
||||||
} STMT_t;
|
}
|
||||||
|
STMT_t;
|
||||||
|
|
||||||
enum {
|
enum
|
||||||
|
{
|
||||||
en_stmt_allocated = 0,
|
en_stmt_allocated = 0,
|
||||||
en_stmt_prepared,
|
en_stmt_prepared,
|
||||||
en_stmt_executed,
|
en_stmt_executed,
|
||||||
@@ -33,16 +60,16 @@ enum {
|
|||||||
en_stmt_needdata, /* not call SQLParamData() yet */
|
en_stmt_needdata, /* not call SQLParamData() yet */
|
||||||
en_stmt_mustput, /* not call SQLPutData() yet */
|
en_stmt_mustput, /* not call SQLPutData() yet */
|
||||||
en_stmt_canput /* SQLPutData() called */
|
en_stmt_canput /* SQLPutData() called */
|
||||||
}; /* for statement handle state */
|
}; /* for statement handle state */
|
||||||
|
|
||||||
enum {
|
enum
|
||||||
|
{
|
||||||
en_stmt_cursor_no = 0,
|
en_stmt_cursor_no = 0,
|
||||||
en_stmt_cursor_named,
|
en_stmt_cursor_named,
|
||||||
en_stmt_cursor_opened,
|
en_stmt_cursor_opened,
|
||||||
en_stmt_cursor_fetched,
|
en_stmt_cursor_fetched,
|
||||||
en_stmt_cursor_xfetched
|
en_stmt_cursor_xfetched
|
||||||
}; /* for statement cursor state */
|
}; /* for statement cursor state */
|
||||||
|
|
||||||
extern RETCODE _iodbcdm_dropstmt();
|
|
||||||
|
|
||||||
|
extern RETCODE _iodbcdm_dropstmt ();
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
455
src/iodbc/info.c
455
src/iodbc/info.c
@@ -1,303 +1,429 @@
|
|||||||
/** Information functions
|
/*
|
||||||
|
* info.c
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Information functions
|
||||||
|
*
|
||||||
|
* The iODBC driver manager.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free
|
||||||
|
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
#include <config.h>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
#include <isql.h>
|
||||||
it under the terms of the GNU General Public License as published by
|
#include <isqlext.h>
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
#include <dlproc.h>
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
**/
|
|
||||||
|
|
||||||
#include <../iodbc/iodbc.h>
|
#include <herr.h>
|
||||||
|
#include <henv.h>
|
||||||
|
#include <hdbc.h>
|
||||||
|
#include <hstmt.h>
|
||||||
|
|
||||||
#include <../iodbc/isql.h>
|
#include <itrace.h>
|
||||||
#include <../iodbc/isqlext.h>
|
|
||||||
|
|
||||||
#include <../iodbc/dlproc.h>
|
|
||||||
|
|
||||||
#include <../iodbc/herr.h>
|
|
||||||
#include <../iodbc/henv.h>
|
|
||||||
#include <../iodbc/hdbc.h>
|
|
||||||
#include <../iodbc/hstmt.h>
|
|
||||||
|
|
||||||
#include <../iodbc/itrace.h>
|
|
||||||
|
|
||||||
#include <strings.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
RETCODE SQL_API SQLDataSources(
|
#define SECT1 "ODBC Data Sources"
|
||||||
|
#define SECT2 "Default"
|
||||||
|
#define MAX_ENTRIES 1024
|
||||||
|
|
||||||
|
extern char * _iodbcdm_getinifile (char *buf, int size);
|
||||||
|
extern char * _iodbcdm_getkeyvalbydsn (char *dsn, int dsnlen, char *keywd, char *value, int size);
|
||||||
|
|
||||||
|
static int
|
||||||
|
stricmp (const char *s1, const char *s2)
|
||||||
|
{
|
||||||
|
int cmp;
|
||||||
|
|
||||||
|
while (*s1)
|
||||||
|
{
|
||||||
|
if ((cmp = toupper (*s1) - toupper (*s2)) != 0)
|
||||||
|
return cmp;
|
||||||
|
s1++;
|
||||||
|
s2++;
|
||||||
|
}
|
||||||
|
return (*s2) ? -1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
SectSorter (const void *p1, const void *p2)
|
||||||
|
{
|
||||||
|
char **s1 = (char **) p1;
|
||||||
|
char **s2 = (char **) p2;
|
||||||
|
|
||||||
|
return stricmp (*s1, *s2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
RETCODE SQL_API
|
||||||
|
SQLDataSources (
|
||||||
HENV henv,
|
HENV henv,
|
||||||
UWORD fDir,
|
UWORD fDir,
|
||||||
UCHAR FAR* szDSN,
|
UCHAR FAR * szDSN,
|
||||||
SWORD cbDSNMax,
|
SWORD cbDSNMax,
|
||||||
SWORD FAR* pcbDSN,
|
SWORD FAR * pcbDSN,
|
||||||
UCHAR FAR* szDesc,
|
UCHAR FAR * szDesc,
|
||||||
SWORD cbDescMax,
|
SWORD cbDescMax,
|
||||||
SWORD FAR* pcbDesc )
|
SWORD FAR * pcbDesc)
|
||||||
{
|
{
|
||||||
GENV_t FAR* genv = (GENV_t FAR*)henv;
|
GENV_t FAR *genv = (GENV_t FAR *) henv;
|
||||||
|
char *path;
|
||||||
|
char buf[1024];
|
||||||
|
FILE *fp;
|
||||||
|
int i;
|
||||||
|
static int cur_entry = -1;
|
||||||
|
static int num_entries = 0;
|
||||||
|
static char **sect = NULL;
|
||||||
|
|
||||||
if( henv == SQL_NULL_HENV )
|
if (henv == SQL_NULL_HENV)
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check argument */
|
/* check argument */
|
||||||
if( cbDSNMax < 0 || cbDescMax < 0 )
|
if (cbDSNMax < 0 || cbDescMax < 0)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( genv->herr, en_S1090 );
|
PUSHSQLERR (genv->herr, en_S1090);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
if (fDir != SQL_FETCH_FIRST
|
||||||
if( fDir != SQL_FETCH_FIRST
|
&& fDir != SQL_FETCH_NEXT)
|
||||||
&& fDir != SQL_FETCH_NEXT )
|
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( genv->herr, en_S1103 );
|
PUSHSQLERR (genv->herr, en_S1103);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
if (cur_entry < 0 || fDir == SQL_FETCH_FIRST)
|
||||||
|
{
|
||||||
|
cur_entry = 0;
|
||||||
|
num_entries = 0;
|
||||||
|
|
||||||
/*************************/
|
|
||||||
|
/*
|
||||||
|
* Open the odbc.ini file
|
||||||
|
*/
|
||||||
|
path = (char *) _iodbcdm_getinifile (buf, sizeof (buf));
|
||||||
|
if ((fp = fopen (path, "r")) == NULL)
|
||||||
|
{
|
||||||
|
return SQL_NO_DATA_FOUND;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Free old section list
|
||||||
|
*/
|
||||||
|
if (sect)
|
||||||
|
{
|
||||||
|
for (i = 0; i < MAX_ENTRIES; i++)
|
||||||
|
if (sect[i])
|
||||||
|
free (sect[i]);
|
||||||
|
free (sect);
|
||||||
|
}
|
||||||
|
if ((sect = (char **) calloc (MAX_ENTRIES, sizeof (char *))) == NULL)
|
||||||
|
{
|
||||||
|
PUSHSQLERR (genv->herr, en_S1011);
|
||||||
|
|
||||||
|
return SQL_ERROR;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Build a dynamic list of sections
|
||||||
|
*/
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
char *str, *p;
|
||||||
|
|
||||||
|
str = fgets (buf, sizeof (buf), fp);
|
||||||
|
|
||||||
|
if (str == NULL)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (*str == '[')
|
||||||
|
{
|
||||||
|
str++;
|
||||||
|
for (p = str; *p; p++)
|
||||||
|
if (*p == ']')
|
||||||
|
*p = '\0';
|
||||||
|
|
||||||
|
if (!strcmp (str, SECT1))
|
||||||
|
continue;
|
||||||
|
if (!strcmp (str, SECT2))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Add this section to the comma separated list
|
||||||
|
*/
|
||||||
|
if (num_entries >= MAX_ENTRIES)
|
||||||
|
break; /* Skip the rest */
|
||||||
|
|
||||||
|
sect[num_entries++] = (char *) strdup (str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Sort all entries so we can present a nice list
|
||||||
|
*/
|
||||||
|
if (num_entries > 1)
|
||||||
|
qsort (sect, num_entries, sizeof (char *), SectSorter);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Try to get to the next item
|
||||||
|
*/
|
||||||
|
if (cur_entry >= num_entries)
|
||||||
|
{
|
||||||
|
cur_entry = 0; /* Next time, start all over again */
|
||||||
|
return SQL_NO_DATA_FOUND;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Copy DSN information
|
||||||
|
*/
|
||||||
|
STRNCPY (szDSN, sect[cur_entry], cbDSNMax);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* And find the description that goes with this entry
|
||||||
|
*/
|
||||||
|
_iodbcdm_getkeyvalbydsn (sect[cur_entry], strlen (sect[cur_entry]),
|
||||||
|
"Description", szDesc, cbDescMax);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Next record
|
||||||
|
*/
|
||||||
|
cur_entry++;
|
||||||
|
|
||||||
return SQL_SUCCESS;
|
return SQL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETCODE SQL_API SQLDrivers(
|
|
||||||
|
RETCODE SQL_API
|
||||||
|
SQLDrivers (
|
||||||
HENV henv,
|
HENV henv,
|
||||||
UWORD fDir,
|
UWORD fDir,
|
||||||
UCHAR FAR* szDrvDesc,
|
UCHAR FAR * szDrvDesc,
|
||||||
SWORD cbDrvDescMax,
|
SWORD cbDrvDescMax,
|
||||||
SWORD FAR* pcbDrvDesc,
|
SWORD FAR * pcbDrvDesc,
|
||||||
UCHAR FAR* szDrvAttr,
|
UCHAR FAR * szDrvAttr,
|
||||||
SWORD cbDrvAttrMax,
|
SWORD cbDrvAttrMax,
|
||||||
SWORD FAR* pcbDrvAttr )
|
SWORD FAR * pcbDrvAttr)
|
||||||
{
|
{
|
||||||
GENV_t FAR* genv = (GENV_t FAR*)henv;
|
GENV_t FAR *genv = (GENV_t FAR *) henv;
|
||||||
|
|
||||||
if( henv == SQL_NULL_HENV )
|
if (henv == SQL_NULL_HENV)
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( cbDrvDescMax < 0
|
if (cbDrvDescMax < 0 || cbDrvAttrMax < 0 || cbDrvAttrMax == 1)
|
||||||
|| cbDrvAttrMax < 0
|
|
||||||
|| cbDrvAttrMax == 1 )
|
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( genv->herr, en_S1090 );
|
PUSHSQLERR (genv->herr, en_S1090);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( fDir != SQL_FETCH_FIRST
|
if (fDir != SQL_FETCH_FIRST || fDir != SQL_FETCH_NEXT)
|
||||||
|| fDir != SQL_FETCH_NEXT )
|
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( genv->herr, en_S1103 );
|
PUSHSQLERR (genv->herr, en_S1103);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************/
|
/*********************/
|
||||||
return SQL_SUCCESS;
|
return SQL_NO_DATA_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
RETCODE SQL_API SQLGetInfo(
|
RETCODE SQL_API
|
||||||
|
SQLGetInfo (
|
||||||
HDBC hdbc,
|
HDBC hdbc,
|
||||||
UWORD fInfoType,
|
UWORD fInfoType,
|
||||||
PTR rgbInfoValue,
|
PTR rgbInfoValue,
|
||||||
SWORD cbInfoValueMax,
|
SWORD cbInfoValueMax,
|
||||||
SWORD FAR* pcbInfoValue )
|
SWORD FAR * pcbInfoValue)
|
||||||
{
|
{
|
||||||
DBC_t FAR* pdbc = (DBC_t FAR*)hdbc;
|
DBC_t FAR *pdbc = (DBC_t FAR *) hdbc;
|
||||||
ENV_t FAR* penv;
|
ENV_t FAR *penv;
|
||||||
STMT_t FAR* pstmt = NULL;
|
STMT_t FAR *pstmt = NULL;
|
||||||
STMT_t FAR* tpstmt;
|
STMT_t FAR *tpstmt;
|
||||||
HPROC hproc;
|
HPROC hproc;
|
||||||
RETCODE retcode = SQL_SUCCESS;
|
RETCODE retcode = SQL_SUCCESS;
|
||||||
|
|
||||||
DWORD dword;
|
DWORD dword;
|
||||||
int size = 0, len = 0;
|
int size = 0, len = 0;
|
||||||
char buf[16] = { '\0' };
|
char buf[16] = {'\0'};
|
||||||
|
|
||||||
if( hdbc == SQL_NULL_HDBC
|
if (hdbc == SQL_NULL_HDBC || pdbc->henv == SQL_NULL_HENV)
|
||||||
|| pdbc->henv == SQL_NULL_HENV )
|
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( cbInfoValueMax < 0 )
|
if (cbInfoValueMax < 0)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pdbc->herr, en_S1090 );
|
PUSHSQLERR (pdbc->herr, en_S1090);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( /* fInfoType < SQL_INFO_FIRST || */
|
if ( /* fInfoType < SQL_INFO_FIRST || */
|
||||||
( fInfoType > SQL_INFO_LAST
|
(fInfoType > SQL_INFO_LAST
|
||||||
&& fInfoType < SQL_INFO_DRIVER_START ) )
|
&& fInfoType < SQL_INFO_DRIVER_START))
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pdbc->herr, en_S1096 );
|
PUSHSQLERR (pdbc->herr, en_S1096);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( fInfoType == SQL_ODBC_VER )
|
if (fInfoType == SQL_ODBC_VER)
|
||||||
{
|
{
|
||||||
sprintf( buf, "%02d.%02d",
|
sprintf (buf, "%02d.%02d",
|
||||||
(ODBCVER)>>8, 0x00FF&(ODBCVER) );
|
(ODBCVER) >> 8, 0x00FF & (ODBCVER));
|
||||||
|
|
||||||
|
|
||||||
if( rgbInfoValue != NULL
|
if (rgbInfoValue != NULL
|
||||||
&& cbInfoValueMax > 0 )
|
&& cbInfoValueMax > 0)
|
||||||
{
|
{
|
||||||
len = STRLEN( buf );
|
len = STRLEN (buf);
|
||||||
|
|
||||||
if( len < cbInfoValueMax - 1 )
|
if (len < cbInfoValueMax - 1)
|
||||||
{
|
{
|
||||||
len = cbInfoValueMax - 1;
|
len = cbInfoValueMax - 1;
|
||||||
PUSHSQLERR ( pdbc->herr, en_01004 );
|
PUSHSQLERR (pdbc->herr, en_01004);
|
||||||
|
|
||||||
retcode = SQL_SUCCESS_WITH_INFO;
|
retcode = SQL_SUCCESS_WITH_INFO;
|
||||||
}
|
}
|
||||||
|
|
||||||
STRNCPY( rgbInfoValue, buf, len );
|
STRNCPY (rgbInfoValue, buf, len);
|
||||||
((char FAR*)rgbInfoValue)[len] = '\0';
|
((char FAR *) rgbInfoValue)[len] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pcbInfoValue != NULL )
|
if (pcbInfoValue != NULL)
|
||||||
{
|
{
|
||||||
*pcbInfoValue = (SWORD)len;
|
*pcbInfoValue = (SWORD) len;
|
||||||
}
|
}
|
||||||
|
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdbc->state == en_dbc_allocated
|
if (pdbc->state == en_dbc_allocated || pdbc->state == en_dbc_needdata)
|
||||||
|| pdbc->state == en_dbc_needdata )
|
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pdbc->herr, en_08003 );
|
PUSHSQLERR (pdbc->herr, en_08003);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( fInfoType )
|
switch (fInfoType)
|
||||||
{
|
{
|
||||||
case SQL_DRIVER_HDBC:
|
case SQL_DRIVER_HDBC:
|
||||||
dword = (DWORD)(pdbc->dhdbc);
|
dword = (DWORD) (pdbc->dhdbc);
|
||||||
size = sizeof(dword);
|
size = sizeof (dword);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SQL_DRIVER_HENV:
|
case SQL_DRIVER_HENV:
|
||||||
penv = (ENV_t FAR*)(pdbc->henv);
|
penv = (ENV_t FAR *) (pdbc->henv);
|
||||||
dword = (DWORD)(penv->dhenv);
|
dword = (DWORD) (penv->dhenv);
|
||||||
size = sizeof(dword);
|
size = sizeof (dword);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SQL_DRIVER_HLIB:
|
case SQL_DRIVER_HLIB:
|
||||||
penv = (ENV_t FAR*)(pdbc->henv);
|
penv = (ENV_t FAR *) (pdbc->henv);
|
||||||
dword = (DWORD)(penv->hdll);
|
dword = (DWORD) (penv->hdll);
|
||||||
size = sizeof(dword);
|
size = sizeof (dword);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SQL_DRIVER_HSTMT:
|
case SQL_DRIVER_HSTMT:
|
||||||
if( rgbInfoValue != NULL )
|
if (rgbInfoValue != NULL)
|
||||||
{
|
{
|
||||||
pstmt = *((STMT_t FAR**)rgbInfoValue);
|
pstmt = *((STMT_t FAR **) rgbInfoValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
for( tpstmt = (STMT_t FAR*)(pdbc->hstmt);
|
for (tpstmt = (STMT_t FAR *) (pdbc->hstmt);
|
||||||
tpstmt != NULL;
|
tpstmt != NULL;
|
||||||
tpstmt = tpstmt->next )
|
tpstmt = tpstmt->next)
|
||||||
{
|
{
|
||||||
if( tpstmt == pstmt )
|
if (tpstmt == pstmt)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( tpstmt == NULL )
|
if (tpstmt == NULL)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pdbc->herr, en_S1009 );
|
PUSHSQLERR (pdbc->herr, en_S1009);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
dword = (DWORD)(pstmt->dhstmt);
|
dword = (DWORD) (pstmt->dhstmt);
|
||||||
size = sizeof(dword);
|
size = sizeof (dword);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( size )
|
if (size)
|
||||||
{
|
{
|
||||||
if( rgbInfoValue != NULL )
|
if (rgbInfoValue != NULL)
|
||||||
{
|
{
|
||||||
*((DWORD*)rgbInfoValue) = dword;
|
*((DWORD *) rgbInfoValue) = dword;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pcbInfoValue != NULL )
|
if (pcbInfoValue != NULL)
|
||||||
{
|
{
|
||||||
*(pcbInfoValue) = (SWORD)size;
|
*(pcbInfoValue) = (SWORD) size;
|
||||||
}
|
}
|
||||||
|
|
||||||
return SQL_SUCCESS;
|
return SQL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
hproc = _iodbcdm_getproc( hdbc, en_GetInfo );
|
hproc = _iodbcdm_getproc (hdbc, en_GetInfo);
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
if (hproc == SQL_NULL_HPROC)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pdbc->herr, en_IM001 );
|
PUSHSQLERR (pdbc->herr, en_IM001);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
CALL_DRIVER ( hdbc, retcode, hproc, en_GetInfo, (
|
CALL_DRIVER (hdbc, retcode, hproc, en_GetInfo,
|
||||||
pdbc->dhdbc,
|
(pdbc->dhdbc, fInfoType, rgbInfoValue, cbInfoValueMax, pcbInfoValue))
|
||||||
fInfoType,
|
|
||||||
rgbInfoValue,
|
|
||||||
cbInfoValueMax,
|
|
||||||
pcbInfoValue ) )
|
|
||||||
|
|
||||||
#if 0
|
if (retcode == SQL_ERROR
|
||||||
retcode = hproc(pdbc->dhdbc,
|
&& fInfoType == SQL_DRIVER_ODBC_VER)
|
||||||
fInfoType,
|
|
||||||
rgbInfoValue,
|
|
||||||
cbInfoValueMax,
|
|
||||||
pcbInfoValue );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if( retcode == SQL_ERROR
|
|
||||||
&& fInfoType == SQL_DRIVER_ODBC_VER )
|
|
||||||
{
|
{
|
||||||
STRCPY( buf, "01.00" );
|
STRCPY (buf, "01.00");
|
||||||
|
|
||||||
if( rgbInfoValue != NULL
|
if (rgbInfoValue != NULL
|
||||||
&& cbInfoValueMax > 0 )
|
&& cbInfoValueMax > 0)
|
||||||
{
|
{
|
||||||
len = STRLEN( buf );
|
len = STRLEN (buf);
|
||||||
|
|
||||||
if( len < cbInfoValueMax - 1 )
|
if (len < cbInfoValueMax - 1)
|
||||||
{
|
{
|
||||||
len = cbInfoValueMax - 1;
|
len = cbInfoValueMax - 1;
|
||||||
PUSHSQLERR ( pdbc->herr, en_01004 );
|
PUSHSQLERR (pdbc->herr, en_01004);
|
||||||
}
|
}
|
||||||
|
|
||||||
STRNCPY( rgbInfoValue, buf, len );
|
STRNCPY (rgbInfoValue, buf, len);
|
||||||
((char FAR*)rgbInfoValue)[len] = '\0';
|
((char FAR *) rgbInfoValue)[len] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pcbInfoValue != NULL )
|
if (pcbInfoValue != NULL)
|
||||||
{
|
{
|
||||||
*pcbInfoValue = (SWORD)len;
|
*pcbInfoValue = (SWORD) len;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* what should we return in this case ???? */
|
/* what should we return in this case ???? */
|
||||||
@@ -306,85 +432,84 @@ RETCODE SQL_API SQLGetInfo(
|
|||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETCODE SQL_API SQLGetFunctions(
|
|
||||||
|
RETCODE SQL_API
|
||||||
|
SQLGetFunctions (
|
||||||
HDBC hdbc,
|
HDBC hdbc,
|
||||||
UWORD fFunc,
|
UWORD fFunc,
|
||||||
UWORD FAR* pfExists )
|
UWORD FAR * pfExists)
|
||||||
{
|
{
|
||||||
DBC_t FAR* pdbc = (DBC_t FAR*)hdbc;
|
DBC_t FAR *pdbc = (DBC_t FAR *) hdbc;
|
||||||
HPROC hproc;
|
HPROC hproc;
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
|
|
||||||
if( hdbc == SQL_NULL_HDBC )
|
if (hdbc == SQL_NULL_HDBC)
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( fFunc > SQL_EXT_API_LAST )
|
if (fFunc > SQL_EXT_API_LAST)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pdbc->herr, en_S1095 );
|
PUSHSQLERR (pdbc->herr, en_S1095);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pdbc->state == en_dbc_allocated
|
if (pdbc->state == en_dbc_allocated
|
||||||
|| pdbc->state == en_dbc_needdata )
|
|| pdbc->state == en_dbc_needdata)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pdbc->herr, en_S1010 );
|
PUSHSQLERR (pdbc->herr, en_S1010);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pfExists == NULL )
|
if (pfExists == NULL)
|
||||||
{
|
{
|
||||||
return SQL_SUCCESS;
|
return SQL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
hproc = _iodbcdm_getproc( hdbc, en_GetFunctions );
|
hproc = _iodbcdm_getproc (hdbc, en_GetFunctions);
|
||||||
|
|
||||||
if( hproc != SQL_NULL_HPROC )
|
if (hproc != SQL_NULL_HPROC)
|
||||||
{
|
{
|
||||||
CALL_DRIVER ( hdbc, retcode, hproc, en_GetFunctions, (
|
CALL_DRIVER (hdbc, retcode, hproc, en_GetFunctions,
|
||||||
pdbc->dhdbc, fFunc, pfExists ) )
|
(pdbc->dhdbc, fFunc, pfExists))
|
||||||
|
|
||||||
#if 0
|
|
||||||
retcode = hproc( pdbc->dhdbc, fFunc, pfExists );
|
|
||||||
#endif
|
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( fFunc == SQL_API_SQLSETPARAM )
|
if (fFunc == SQL_API_SQLSETPARAM)
|
||||||
{
|
{
|
||||||
fFunc = SQL_API_SQLBINDPARAMETER;
|
fFunc = SQL_API_SQLBINDPARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( fFunc != SQL_API_ALL_FUNCTIONS )
|
if (fFunc != SQL_API_ALL_FUNCTIONS)
|
||||||
{
|
{
|
||||||
hproc = _iodbcdm_getproc( hdbc, fFunc );
|
hproc = _iodbcdm_getproc (hdbc, fFunc);
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
if (hproc == SQL_NULL_HPROC)
|
||||||
{
|
{
|
||||||
*pfExists = (UWORD)0;
|
*pfExists = (UWORD) 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*pfExists = (UWORD)1;
|
*pfExists = (UWORD) 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return SQL_SUCCESS;
|
return SQL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( fFunc=0 ; fFunc < 100; fFunc ++ )
|
for (fFunc = 0; fFunc < 100; fFunc++)
|
||||||
{
|
{
|
||||||
hproc = _iodbcdm_getproc( hdbc, fFunc );
|
hproc = _iodbcdm_getproc (hdbc, fFunc);
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
if (hproc == SQL_NULL_HPROC)
|
||||||
{
|
{
|
||||||
pfExists[fFunc] = (UWORD)0;
|
pfExists[fFunc] = (UWORD) 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pfExists[fFunc] = (UWORD)1;
|
pfExists[fFunc] = (UWORD) 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
386
src/iodbc/isql.h
386
src/iodbc/isql.h
@@ -1,192 +1,228 @@
|
|||||||
#ifndef _INTRINSIC_SQL_H
|
/*
|
||||||
# define _INTRINSIC_SQL_H
|
* isql.h
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* iODBC defines
|
||||||
|
*
|
||||||
|
* The iODBC driver manager.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free
|
||||||
|
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
#ifndef _ISQL_H
|
||||||
|
#define _ISQL_H
|
||||||
|
|
||||||
#ifndef OS2
|
#ifdef WIN32
|
||||||
typedef unsigned char UCHAR;
|
#define SQL_API __stdcall
|
||||||
|
#else
|
||||||
|
#define FAR
|
||||||
|
#define EXPORT
|
||||||
|
#define CALLBACK
|
||||||
|
#define SQL_API EXPORT CALLBACK
|
||||||
|
|
||||||
|
typedef void *HWND;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
typedef unsigned char UCHAR;
|
||||||
typedef long int SDWORD;
|
typedef long int SDWORD;
|
||||||
typedef short int SWORD;
|
typedef short int SWORD;
|
||||||
typedef unsigned long int UDWORD;
|
typedef unsigned long int UDWORD;
|
||||||
typedef unsigned short int UWORD;
|
typedef unsigned short int UWORD;
|
||||||
typedef unsigned int UINT;
|
|
||||||
|
|
||||||
#ifndef FAR
|
typedef void FAR *PTR;
|
||||||
# define FAR
|
typedef void FAR *HENV;
|
||||||
#endif
|
typedef void FAR *HDBC;
|
||||||
#ifndef NEAR
|
typedef void FAR *HSTMT;
|
||||||
# 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 signed short RETCODE;
|
||||||
typedef UCHAR SQLCHAR;
|
#define SQLRETURN RETCODE
|
||||||
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 0x0250
|
||||||
# define ODBCVER 0x0200
|
|
||||||
|
#define SQL_MAX_MESSAGE_LENGTH 512
|
||||||
|
#define SQL_MAX_DSN_LENGTH 32
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Function return codes
|
||||||
|
*/
|
||||||
|
#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, using 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 datatype 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
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NULL status constants.
|
||||||
|
*/
|
||||||
|
#define SQL_NO_NULLS 0
|
||||||
|
#define SQL_NULLABLE 1
|
||||||
|
#define SQL_NULLABLE_UNKNOWN 2
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Special length values
|
||||||
|
*/
|
||||||
|
#define SQL_NULL_DATA (-1)
|
||||||
|
#define SQL_DATA_AT_EXEC (-2)
|
||||||
|
#define SQL_NTS (-3)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SQLFreeStmt
|
||||||
|
*/
|
||||||
|
#define SQL_CLOSE 0
|
||||||
|
#define SQL_DROP 1
|
||||||
|
#define SQL_UNBIND 2
|
||||||
|
#define SQL_RESET_PARAMS 3
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SQLTransact
|
||||||
|
*/
|
||||||
|
#define SQL_COMMIT 0
|
||||||
|
#define SQL_ROLLBACK 1
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SQLColAttributes
|
||||||
|
*/
|
||||||
|
#define SQL_COLUMN_COUNT 0
|
||||||
|
#define SQL_COLUMN_NAME 1
|
||||||
|
#define SQL_COLUMN_TYPE 2
|
||||||
|
#define SQL_COLUMN_LENGTH 3
|
||||||
|
#define SQL_COLUMN_PRECISION 4
|
||||||
|
#define SQL_COLUMN_SCALE 5
|
||||||
|
#define SQL_COLUMN_DISPLAY_SIZE 6
|
||||||
|
#define SQL_COLUMN_NULLABLE 7
|
||||||
|
#define SQL_COLUMN_UNSIGNED 8
|
||||||
|
#define SQL_COLUMN_MONEY 9
|
||||||
|
#define SQL_COLUMN_UPDATABLE 10
|
||||||
|
#define SQL_COLUMN_AUTO_INCREMENT 11
|
||||||
|
#define SQL_COLUMN_CASE_SENSITIVE 12
|
||||||
|
#define SQL_COLUMN_SEARCHABLE 13
|
||||||
|
#define SQL_COLUMN_TYPE_NAME 14
|
||||||
|
#define SQL_COLUMN_TABLE_NAME 15
|
||||||
|
#define SQL_COLUMN_OWNER_NAME 16
|
||||||
|
#define SQL_COLUMN_QUALIFIER_NAME 17
|
||||||
|
#define SQL_COLUMN_LABEL 18
|
||||||
|
|
||||||
|
#define SQL_COLATT_OPT_MAX SQL_COLUMN_LABEL
|
||||||
|
#define SQL_COLATT_OPT_MIN SQL_COLUMN_COUNT
|
||||||
|
#define SQL_COLUMN_DRIVER_START 1000
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SQLColAttributes : SQL_COLUMN_UPDATABLE
|
||||||
|
*/
|
||||||
|
#define SQL_ATTR_READONLY 0
|
||||||
|
#define SQL_ATTR_WRITE 1
|
||||||
|
#define SQL_ATTR_READWRITE_UNKNOWN 2
|
||||||
|
|
||||||
|
/*
|
||||||
|
* SQLColAttributes : SQL_COLUMN_SEARCHABLE
|
||||||
|
*/
|
||||||
|
#define SQL_UNSEARCHABLE 0
|
||||||
|
#define SQL_LIKE_ONLY 1
|
||||||
|
#define SQL_ALL_EXCEPT_LIKE 2
|
||||||
|
#define SQL_SEARCHABLE 3
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NULL Handles
|
||||||
|
*/
|
||||||
|
#define SQL_NULL_HENV 0
|
||||||
|
#define SQL_NULL_HDBC 0
|
||||||
|
#define SQL_NULL_HSTMT 0
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Function Prototypes
|
||||||
|
*/
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# define SQL_MAX_MESSAGE_LENGTH 512
|
RETCODE SQL_API SQLAllocConnect (HENV henv, HDBC FAR * phdbc);
|
||||||
# define SQL_MAX_DSN_LENGTH 32
|
RETCODE SQL_API SQLAllocEnv (HENV FAR * phenv);
|
||||||
|
RETCODE SQL_API SQLAllocStmt (HDBC hdbc, HSTMT FAR * phstmt);
|
||||||
|
RETCODE SQL_API SQLBindCol (HSTMT hstmt, UWORD icol, SWORD fCType,
|
||||||
|
PTR rgbValue, SDWORD cbValueMax, SDWORD FAR * pcbValue);
|
||||||
|
RETCODE SQL_API SQLCancel (HSTMT hstmt);
|
||||||
|
RETCODE SQL_API SQLColAttributes (HSTMT hstmt, UWORD icol, UWORD fDescType,
|
||||||
|
PTR rgbDesc, SWORD cbDescMax, SWORD FAR * pcbDesc, SDWORD FAR * pfDesc);
|
||||||
|
RETCODE SQL_API SQLConnect (HDBC hdbc, UCHAR FAR * szDSN, SWORD cbDSN,
|
||||||
|
UCHAR FAR * szUID, SWORD cbUID, UCHAR FAR * szAuthStr, SWORD cbAuthStr);
|
||||||
|
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 SQLDisconnect (HDBC hdbc);
|
||||||
|
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 SQLExecDirect (HSTMT hstmt, UCHAR FAR * szSqlStr,
|
||||||
|
SDWORD cbSqlStr);
|
||||||
|
RETCODE SQL_API SQLExecute (HSTMT hstmt);
|
||||||
|
RETCODE SQL_API SQLFetch (HSTMT hstmt);
|
||||||
|
RETCODE SQL_API SQLFreeConnect (HDBC hdbc);
|
||||||
|
RETCODE SQL_API SQLFreeEnv (HENV henv);
|
||||||
|
RETCODE SQL_API SQLFreeStmt (HSTMT hstmt, UWORD fOption);
|
||||||
|
RETCODE SQL_API SQLGetCursorName (HSTMT hstmt, UCHAR FAR * szCursor,
|
||||||
|
SWORD cbCursorMax, SWORD FAR * pcbCursor);
|
||||||
|
RETCODE SQL_API SQLNumResultCols (HSTMT hstmt, SWORD FAR * pccol);
|
||||||
|
RETCODE SQL_API SQLPrepare (HSTMT hstmt, UCHAR FAR * szSqlStr,
|
||||||
|
SDWORD cbSqlStr);
|
||||||
|
RETCODE SQL_API SQLRowCount (HSTMT hstmt, SDWORD FAR * pcrow);
|
||||||
|
RETCODE SQL_API SQLSetCursorName (HSTMT hstmt, UCHAR FAR * szCursor,
|
||||||
|
SWORD cbCursor);
|
||||||
|
RETCODE SQL_API SQLTransact (HENV henv, HDBC hdbc, UWORD fType);
|
||||||
|
|
||||||
/* return code */
|
/*
|
||||||
# define SQL_INVALID_HANDLE (-2)
|
* Depreciated ODBC 1.0 function - Use SQLBindParameter
|
||||||
# define SQL_ERROR (-1)
|
*/
|
||||||
# define SQL_SUCCESS 0
|
RETCODE SQL_API SQLSetParam (HSTMT hstmt, UWORD ipar, SWORD fCType,
|
||||||
# define SQL_SUCCESS_WITH_INFO 1
|
SWORD fSqlType, UDWORD cbColDef, SWORD ibScale, PTR rgbValue,
|
||||||
# define SQL_NO_DATA_FOUND 100
|
SDWORD FAR * pcbValue);
|
||||||
|
|
||||||
/* 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
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
1377
src/iodbc/isqlext.h
1377
src/iodbc/isqlext.h
File diff suppressed because it is too large
Load Diff
@@ -1,39 +1,51 @@
|
|||||||
/** trace functions
|
/*
|
||||||
|
* itrace.c
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Trace functions
|
||||||
|
*
|
||||||
|
* The iODBC driver manager.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free
|
||||||
|
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
#include <config.h>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
#include <isql.h>
|
||||||
it under the terms of the GNU General Public License as published by
|
#include <isqlext.h>
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
#include <dlproc.h>
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
**/
|
|
||||||
|
|
||||||
#include <../iodbc/iodbc.h>
|
#include <itrace.h>
|
||||||
|
|
||||||
#include <../iodbc/isql.h>
|
#include <herr.h>
|
||||||
#include <../iodbc/isqlext.h>
|
#include <henv.h>
|
||||||
|
#include "henv.ci"
|
||||||
#include <../iodbc/dlproc.h>
|
|
||||||
|
|
||||||
#include <../iodbc/itrace.h>
|
|
||||||
|
|
||||||
#include <../iodbc/herr.h>
|
|
||||||
#include <../iodbc/henv.h>
|
|
||||||
#include "../iodbc/henv.ci"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
static int printreturn(void FAR* istm, int ret )
|
static int
|
||||||
|
printreturn (void FAR * istm, int ret)
|
||||||
{
|
{
|
||||||
FILE FAR* stm = (FILE FAR*)istm;
|
FILE FAR *stm = (FILE FAR *) istm;
|
||||||
char FAR* ptr = "Invalid return value";
|
char FAR *ptr = "Invalid return value";
|
||||||
|
|
||||||
switch( ret )
|
switch (ret)
|
||||||
{
|
{
|
||||||
case SQL_SUCCESS:
|
case SQL_SUCCESS:
|
||||||
ptr = "SQL_SUCCESS";
|
ptr = "SQL_SUCCESS";
|
||||||
@@ -67,37 +79,38 @@ static int printreturn(void FAR* istm, int ret )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf( stm, "%s\n", ptr);
|
fprintf (stm, "%s\n", ptr);
|
||||||
fflush( stm );
|
fflush (stm);
|
||||||
|
|
||||||
return 0;
|
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 )
|
if (type == TRACE_TYPE_DM2DRV)
|
||||||
{
|
{
|
||||||
int i,j = 0;
|
int i, j = 0;
|
||||||
|
|
||||||
for(i=0;j != en_NullProc ;i++)
|
for (i = 0; j != en_NullProc; i++)
|
||||||
{
|
{
|
||||||
j = odbcapi_symtab[i].en_idx;
|
j = odbcapi_symtab[i].en_idx;
|
||||||
|
|
||||||
if( j == procid )
|
if (j == procid)
|
||||||
{
|
{
|
||||||
fprintf( stm, "\n%s ( ... )\n",
|
fprintf (stm, "\n%s ( ... )\n", odbcapi_symtab[i].symbol);
|
||||||
odbcapi_symtab[i].symbol);
|
|
||||||
|
|
||||||
fflush( stm );
|
fflush (stm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( type == TRACE_TYPE_RETURN )
|
if (type == TRACE_TYPE_RETURN)
|
||||||
{
|
{
|
||||||
return (HPROC)printreturn;
|
return (HPROC) printreturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
return SQL_NULL_HPROC;
|
return SQL_NULL_HPROC;
|
||||||
|
|||||||
@@ -1,26 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* itrace.h
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Trace functions
|
||||||
|
*
|
||||||
|
* The iODBC driver manager.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free
|
||||||
|
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
#ifndef _ITRACE_H
|
#ifndef _ITRACE_H
|
||||||
# define _ITRACE_H
|
#define _ITRACE_H
|
||||||
|
|
||||||
# ifdef DEBUG
|
#ifdef DEBUG
|
||||||
# ifndef NO_TRACE
|
|
||||||
# define NO_TRACE
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
|
|
||||||
|
#ifndef NO_TRACE
|
||||||
#define NO_TRACE
|
#define NO_TRACE
|
||||||
|
#endif
|
||||||
|
|
||||||
# define TRACE_TYPE_APP2DM 1
|
#endif
|
||||||
# define TRACE_TYPE_DM2DRV 2
|
|
||||||
# define TRACE_TYPE_DRV2DM 3
|
|
||||||
|
|
||||||
# define TRACE_TYPE_RETURN 4
|
#define TRACE_TYPE_APP2DM 1
|
||||||
|
#define TRACE_TYPE_DM2DRV 2
|
||||||
|
#define TRACE_TYPE_DRV2DM 3
|
||||||
|
|
||||||
extern HPROC _iodbcdm_gettrproc(void FAR* stm, int procid, int type);
|
#define TRACE_TYPE_RETURN 4
|
||||||
|
|
||||||
# ifdef NO_TRACE
|
extern HPROC _iodbcdm_gettrproc (void FAR * stm, int procid, int type);
|
||||||
# define TRACE_CALL( stm, trace_on, procid, plist )
|
|
||||||
# else
|
#ifdef NO_TRACE
|
||||||
# define TRACE_CALL( stm, trace_on, plist )\
|
#define TRACE_CALL( stm, trace_on, procid, plist )
|
||||||
|
#else
|
||||||
|
#define TRACE_CALL( stm, trace_on, plist )\
|
||||||
{\
|
{\
|
||||||
if( trace_on)\
|
if( trace_on)\
|
||||||
{\
|
{\
|
||||||
@@ -32,12 +57,12 @@ extern HPROC _iodbcdm_gettrproc(void FAR* stm, int procid, int type);
|
|||||||
hproc plist;\
|
hproc plist;\
|
||||||
}\
|
}\
|
||||||
}
|
}
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
# ifdef NO_TRACE
|
#ifdef NO_TRACE
|
||||||
# define TRACE_DM2DRV( stm, procid, plist )
|
#define TRACE_DM2DRV( stm, procid, plist )
|
||||||
# else
|
#else
|
||||||
# define TRACE_DM2DRV( stm, procid, plist )\
|
#define TRACE_DM2DRV( stm, procid, plist )\
|
||||||
{\
|
{\
|
||||||
HPROC hproc;\
|
HPROC hproc;\
|
||||||
\
|
\
|
||||||
@@ -46,12 +71,12 @@ extern HPROC _iodbcdm_gettrproc(void FAR* stm, int procid, int type);
|
|||||||
if( hproc )\
|
if( hproc )\
|
||||||
hproc plist;\
|
hproc plist;\
|
||||||
}
|
}
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
# ifdef NO_TRACE
|
#ifdef NO_TRACE
|
||||||
# define TRACE_DRV2DM( stm, procid, plist )
|
#define TRACE_DRV2DM( stm, procid, plist )
|
||||||
# else
|
#else
|
||||||
# define TRACE_DRV2DM( stm, procid, plist ) \
|
#define TRACE_DRV2DM( stm, procid, plist ) \
|
||||||
{\
|
{\
|
||||||
HPROC hproc;\
|
HPROC hproc;\
|
||||||
\
|
\
|
||||||
@@ -60,12 +85,12 @@ extern HPROC _iodbcdm_gettrproc(void FAR* stm, int procid, int type);
|
|||||||
if( hproc )\
|
if( hproc )\
|
||||||
hproc plist;\
|
hproc plist;\
|
||||||
}
|
}
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
# ifdef NO_TRACE
|
#ifdef NO_TRACE
|
||||||
# define TRACE_RETURN( stm, trace_on, ret )
|
#define TRACE_RETURN( stm, trace_on, ret )
|
||||||
# else
|
#else
|
||||||
# define TRACE_RETURN( stm, trace_on, ret )\
|
#define TRACE_RETURN( stm, trace_on, ret )\
|
||||||
{\
|
{\
|
||||||
if( trace_on ) {\
|
if( trace_on ) {\
|
||||||
HPROC hproc;\
|
HPROC hproc;\
|
||||||
@@ -76,12 +101,12 @@ extern HPROC _iodbcdm_gettrproc(void FAR* stm, int procid, int type);
|
|||||||
hproc( stm, ret );\
|
hproc( stm, ret );\
|
||||||
}\
|
}\
|
||||||
}
|
}
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
# ifdef NO_TRACE
|
#ifdef NO_TRACE
|
||||||
# define CALL_DRIVER( hdbc, ret, proc, procid, plist ) { ret = proc plist; }
|
#define CALL_DRIVER( hdbc, ret, proc, procid, plist ) { ret = proc plist; }
|
||||||
# else
|
#else
|
||||||
# define CALL_DRIVER( hdbc, ret, proc, procid, plist )\
|
#define CALL_DRIVER( hdbc, ret, proc, procid, plist )\
|
||||||
{\
|
{\
|
||||||
DBC_t FAR* pdbc = (DBC_t FAR*)(hdbc);\
|
DBC_t FAR* pdbc = (DBC_t FAR*)(hdbc);\
|
||||||
\
|
\
|
||||||
@@ -94,6 +119,6 @@ extern HPROC _iodbcdm_gettrproc(void FAR* stm, int procid, int type);
|
|||||||
else\
|
else\
|
||||||
ret = proc plist;\
|
ret = proc plist;\
|
||||||
}
|
}
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
#include <config.h>
|
|
||||||
|
|
||||||
/* entry function used to build a share library on AIX */
|
|
||||||
int __start()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
333
src/iodbc/misc.c
333
src/iodbc/misc.c
@@ -1,113 +1,116 @@
|
|||||||
/** miscellaneous functions
|
/*
|
||||||
|
* misc.c
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Miscellaneous functions
|
||||||
|
*
|
||||||
|
* The iODBC driver manager.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free
|
||||||
|
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
#include <config.h>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
#include <isql.h>
|
||||||
it under the terms of the GNU General Public License as published by
|
#include <isqlext.h>
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
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 <../iodbc/isqlext.h>
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <strings.h>
|
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
upper_strneq(
|
upper_strneq (
|
||||||
char* s1,
|
char *s1,
|
||||||
char* s2,
|
char *s2,
|
||||||
int n )
|
int n)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char c1, c2;
|
char c1, c2;
|
||||||
|
|
||||||
for(i=1;i<n;i++)
|
for (i = 1; i < n; i++)
|
||||||
{
|
{
|
||||||
c1 = s1[i];
|
c1 = s1[i];
|
||||||
c2 = s2[i];
|
c2 = s2[i];
|
||||||
|
|
||||||
if( c1 >= 'a' && c1 <= 'z' )
|
if (c1 >= 'a' && c1 <= 'z')
|
||||||
{
|
{
|
||||||
c1 += ('A' - 'a');
|
c1 += ('A' - 'a');
|
||||||
}
|
}
|
||||||
else if( c1 == '\n' )
|
else if (c1 == '\n')
|
||||||
{
|
{
|
||||||
c1 = '\0';
|
c1 = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
if( c2 >= 'a' && c2 <= 'z' )
|
if (c2 >= 'a' && c2 <= 'z')
|
||||||
{
|
{
|
||||||
c2 += ('A' - 'a');
|
c2 += ('A' - 'a');
|
||||||
}
|
}
|
||||||
else if( c2 == '\n' )
|
else if (c2 == '\n')
|
||||||
{
|
{
|
||||||
c2 = '\0';
|
c2 = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
if( (c1 - c2) || !c1 || !c2 )
|
if ((c1 - c2) || !c1 || !c2)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (int)!(c1 - c2);
|
return (int) !(c1 - c2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char* /* return new position in input str */
|
static char * /* return new position in input str */
|
||||||
readtoken(
|
readtoken (
|
||||||
char* istr, /* old position in input buf */
|
char *istr, /* old position in input buf */
|
||||||
char* obuf ) /* token string ( if "\0", then finished ) */
|
char *obuf) /* token string ( if "\0", then finished ) */
|
||||||
{
|
{
|
||||||
for(; *istr && *istr != '\n' ; istr ++ )
|
char *start = obuf;
|
||||||
|
|
||||||
|
/* Skip leading white space */
|
||||||
|
while (*istr == ' ' || *istr == '\t')
|
||||||
|
istr++;
|
||||||
|
|
||||||
|
for (; *istr && *istr != '\n'; istr++)
|
||||||
{
|
{
|
||||||
char c, nx;
|
char c, nx;
|
||||||
|
|
||||||
c = *(istr);
|
c = *(istr);
|
||||||
|
|
||||||
if( c == ' ' || c == '\t' )
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
nx = *(istr + 1);
|
nx = *(istr + 1);
|
||||||
|
|
||||||
|
if (c == ';')
|
||||||
|
{
|
||||||
|
for (; *istr && *istr != '\n'; istr++);
|
||||||
|
break;
|
||||||
|
}
|
||||||
*obuf = c;
|
*obuf = c;
|
||||||
obuf ++;
|
obuf++;
|
||||||
|
|
||||||
if( c == ';' || c == '=' )
|
if (nx == ';' || nx == '=' || c == '=')
|
||||||
{
|
{
|
||||||
istr ++;
|
istr++;
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( nx == ' ' || nx == '\t' || nx == ';' || nx == '=' )
|
|
||||||
{
|
|
||||||
istr ++;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*obuf = '\0';
|
*obuf = '\0';
|
||||||
|
|
||||||
|
/* Trim end of token */
|
||||||
|
for (; obuf > start && (*(obuf - 1) == ' ' || *(obuf - 1) == '\t');)
|
||||||
|
*--obuf = '\0';
|
||||||
|
|
||||||
return istr;
|
return istr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,104 +119,92 @@ readtoken(
|
|||||||
# define UNIX_PWD
|
# define UNIX_PWD
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static char*
|
char *
|
||||||
getinitfile(char* buf, int size)
|
_iodbcdm_getinifile (char *buf, int size)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
char* ptr;
|
char *ptr;
|
||||||
|
|
||||||
j = STRLEN("/odbc.ini") + 1;
|
j = STRLEN ("/odbc.ini") + 1;
|
||||||
|
|
||||||
if( size < j )
|
if (size < j)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FIX_INI_FILE
|
#if !defined(UNIX_PWD)
|
||||||
sprintf( buf, "%s/odbc.ini", DIR_INI_FILE );
|
|
||||||
|
i = GetWindowsDirectory ((LPSTR) buf, size);
|
||||||
|
|
||||||
|
if (i == 0 || i > size - j)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
sprintf (buf + i, "/odbc.ini");
|
||||||
|
|
||||||
|
return buf;
|
||||||
#else
|
#else
|
||||||
# ifdef OS2
|
if ((ptr = getenv ("ODBCINI")) != NULL)
|
||||||
*buf = '\0';
|
|
||||||
if( NULL != getenv("IODBC_INI") )
|
|
||||||
{
|
{
|
||||||
strcpy( buf, getenv("IODBC_INI") );
|
strcpy (buf, ptr);
|
||||||
}
|
|
||||||
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, "odbc.ini" );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
return buf;
|
return buf;
|
||||||
# else
|
}
|
||||||
# if !defined(UNIX_PWD)
|
|
||||||
|
|
||||||
i = GetWindowsDirectory((LPSTR)buf, size );
|
if ((ptr = getenv ("IODBCINI")) != NULL)
|
||||||
|
{
|
||||||
|
strcpy (buf, ptr);
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
if( i == 0 || i > size - j )
|
if ((ptr = getenv ("HOME")) == NULL)
|
||||||
|
{
|
||||||
|
ptr = (char *) getpwuid (getuid ());
|
||||||
|
|
||||||
|
if (ptr == NULL)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf( buf + i, "/odbc.ini");
|
ptr = ((struct passwd *) ptr)->pw_dir;
|
||||||
|
|
||||||
return buf;
|
|
||||||
# else
|
|
||||||
ptr = (char*)getpwuid(getuid());
|
|
||||||
|
|
||||||
if( ptr == NULL )
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr = ((struct passwd*)ptr)->pw_dir;
|
if (ptr == NULL || *ptr == '\0')
|
||||||
|
|
||||||
if( ptr == NULL || *ptr == '\0' )
|
|
||||||
{
|
{
|
||||||
ptr = "/home";
|
ptr = "/home";
|
||||||
}
|
}
|
||||||
|
|
||||||
if( size < STRLEN(ptr) + j )
|
if (size < STRLEN (ptr) + j)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf( buf, "%s%s", ptr, "/.odbc.ini");
|
sprintf (buf, "%s%s", ptr, "/.odbc.ini");
|
||||||
/* i.e. searching ~/.iodbc.ini */
|
/* i.e. searching ~/.odbc.ini */
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* _iodbcdm_getkeyvalbydsn(
|
|
||||||
char* dsn,
|
/*
|
||||||
int dsnlen,
|
* read odbc init file to resolve the value of specified
|
||||||
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 *
|
||||||
|
_iodbcdm_getkeyvalbydsn (
|
||||||
|
char *dsn,
|
||||||
|
int dsnlen,
|
||||||
|
char *keywd,
|
||||||
|
char *value,
|
||||||
|
int size)
|
||||||
{
|
{
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
char dsntk[SQL_MAX_DSN_LENGTH + 3] = { '[', '\0' };
|
char dsntk[SQL_MAX_DSN_LENGTH + 3] = {'[', '\0'};
|
||||||
char token[1024]; /* large enough */
|
char token[1024]; /* large enough */
|
||||||
FILE* file;
|
FILE *file;
|
||||||
char pathbuf[1024];
|
char pathbuf[1024];
|
||||||
char* path;
|
char *path;
|
||||||
|
|
||||||
#define DSN_NOMATCH 0
|
#define DSN_NOMATCH 0
|
||||||
#define DSN_NAMED 1
|
#define DSN_NAMED 1
|
||||||
@@ -222,69 +213,67 @@ char* _iodbcdm_getkeyvalbydsn(
|
|||||||
int dsnid = DSN_NOMATCH;
|
int dsnid = DSN_NOMATCH;
|
||||||
int defaultdsn = DSN_NOMATCH;
|
int defaultdsn = DSN_NOMATCH;
|
||||||
|
|
||||||
if( dsn == NULL || *dsn == 0 )
|
if (dsn == NULL || *dsn == 0)
|
||||||
{
|
{
|
||||||
dsn = "default";
|
dsn = "default";
|
||||||
dsnlen = STRLEN(dsn);
|
dsnlen = STRLEN (dsn);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( dsnlen == SQL_NTS )
|
if (dsnlen == SQL_NTS)
|
||||||
{
|
{
|
||||||
dsnlen = STRLEN(dsn);
|
dsnlen = STRLEN (dsn);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( dsnlen <= 0 || keywd == NULL || buf == 0 || size <= 0 )
|
if (dsnlen <= 0 || keywd == NULL || buf == 0 || size <= 0)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( dsnlen > sizeof(dsntk) - 2 )
|
if (dsnlen > sizeof (dsntk) - 2)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
value[0] = '\0';
|
value[0] = '\0';
|
||||||
|
|
||||||
STRNCAT( dsntk, dsn, dsnlen );
|
STRNCAT (dsntk, dsn, dsnlen);
|
||||||
STRCAT( dsntk, "]" );
|
STRCAT (dsntk, "]");
|
||||||
|
|
||||||
dsnlen = dsnlen + 2;
|
dsnlen = dsnlen + 2;
|
||||||
|
|
||||||
path = getinitfile(pathbuf, sizeof(pathbuf));
|
path = _iodbcdm_getinifile (pathbuf, sizeof (pathbuf));
|
||||||
|
|
||||||
if( path == NULL )
|
if (path == NULL)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
file = (FILE*)fopen(path, "r");
|
file = (FILE *) fopen (path, "r");
|
||||||
|
|
||||||
if( file == NULL )
|
if (file == NULL)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
char* str;
|
char *str;
|
||||||
|
|
||||||
str = fgets(buf, sizeof(buf), file);
|
str = fgets (buf, sizeof (buf), file);
|
||||||
|
|
||||||
if( str == NULL )
|
if (str == NULL)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
strtok( str, "\n\r" );
|
if (*str == '[')
|
||||||
|
|
||||||
if( *str == '[' )
|
|
||||||
{
|
{
|
||||||
if( upper_strneq(str, "[default]", STRLEN("[default]")) )
|
if (upper_strneq (str, "[default]", STRLEN ("[default]")))
|
||||||
{
|
{
|
||||||
/* we only read first dsn default dsn
|
/* we only read first dsn default dsn
|
||||||
* section (as well as named dsn).
|
* section (as well as named dsn).
|
||||||
*/
|
*/
|
||||||
if( defaultdsn == DSN_NOMATCH )
|
if (defaultdsn == DSN_NOMATCH)
|
||||||
{
|
{
|
||||||
dsnid = DSN_DEFAULT;
|
dsnid = DSN_DEFAULT;
|
||||||
defaultdsn = DSN_DEFAULT;
|
defaultdsn = DSN_DEFAULT;
|
||||||
@@ -296,7 +285,7 @@ char* _iodbcdm_getkeyvalbydsn(
|
|||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if( upper_strneq( str, dsntk, dsnlen ) )
|
else if (upper_strneq (str, dsntk, dsnlen))
|
||||||
{
|
{
|
||||||
dsnid = DSN_NAMED;
|
dsnid = DSN_NAMED;
|
||||||
}
|
}
|
||||||
@@ -307,109 +296,111 @@ char* _iodbcdm_getkeyvalbydsn(
|
|||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if( dsnid == DSN_NOMATCH )
|
else if (dsnid == DSN_NOMATCH)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
str = readtoken(str, token);
|
str = readtoken (str, token);
|
||||||
|
|
||||||
if( upper_strneq( keywd, token, STRLEN(keywd)) )
|
if (upper_strneq (keywd, token, STRLEN (keywd)))
|
||||||
{
|
{
|
||||||
str = readtoken(str, token);
|
str = readtoken (str, token);
|
||||||
|
|
||||||
if( ! STREQ( token, "=") )
|
if (!STREQ (token, "="))
|
||||||
/* something other than = */
|
/* something other than = */
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
str = readtoken(str, token);
|
str = readtoken (str, token);
|
||||||
|
|
||||||
if( STRLEN(token) > size - 1)
|
if (STRLEN (token) > size - 1)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
STRNCPY(value, token, size);
|
STRNCPY (value, token, size);
|
||||||
/* copy the value(i.e. next token) to buf */
|
/* copy the value(i.e. next token) to buf */
|
||||||
|
|
||||||
if( dsnid != DSN_DEFAULT )
|
if (dsnid != DSN_DEFAULT)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(file);
|
fclose (file);
|
||||||
|
|
||||||
return (*value)? value:NULL;
|
return (*value) ? value : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* _iodbcdm_getkeyvalinstr(
|
|
||||||
char* cnstr,
|
char *
|
||||||
|
_iodbcdm_getkeyvalinstr (
|
||||||
|
char *cnstr,
|
||||||
int cnlen,
|
int cnlen,
|
||||||
char* keywd,
|
char *keywd,
|
||||||
char* value,
|
char *value,
|
||||||
int size )
|
int size)
|
||||||
{
|
{
|
||||||
char token[1024] = { '\0' };
|
char token[1024] = {'\0'};
|
||||||
int flag = 0;
|
int flag = 0;
|
||||||
|
|
||||||
if( cnstr == NULL || value == NULL
|
if (cnstr == NULL || value == NULL
|
||||||
|| keywd == NULL || size < 1 )
|
|| keywd == NULL || size < 1)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( cnlen == SQL_NTS )
|
if (cnlen == SQL_NTS)
|
||||||
{
|
{
|
||||||
cnlen = STRLEN (cnstr);
|
cnlen = STRLEN (cnstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( cnlen <= 0 )
|
if (cnlen <= 0)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
cnstr = readtoken(cnstr, token);
|
cnstr = readtoken (cnstr, token);
|
||||||
|
|
||||||
if( *token == '\0' )
|
if (*token == '\0')
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( STREQ( token, ";" ) )
|
if (STREQ (token, ";"))
|
||||||
{
|
{
|
||||||
flag = 0;
|
flag = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(flag)
|
switch (flag)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
if( upper_strneq(token, keywd, strlen(keywd)) )
|
if (upper_strneq (token, keywd, strlen (keywd)))
|
||||||
{
|
{
|
||||||
flag = 1;
|
flag = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
if( STREQ( token, "=" ) )
|
if (STREQ (token, "="))
|
||||||
{
|
{
|
||||||
flag = 2;
|
flag = 2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
if( size < strlen(token) + 1 )
|
if (size < strlen (token) + 1)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
STRNCPY( value, token, size );
|
STRNCPY (value, token, size);
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
|
|
||||||
|
|||||||
@@ -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);
|
|
||||||
|
|
||||||
@@ -1,283 +0,0 @@
|
|||||||
#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
|
|
||||||
@@ -1,55 +1,67 @@
|
|||||||
/** Prepare a query
|
/*
|
||||||
|
* prepare.c
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Prepare a query
|
||||||
|
*
|
||||||
|
* The iODBC driver manager.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free
|
||||||
|
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
#include <config.h>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
#include <isql.h>
|
||||||
it under the terms of the GNU General Public License as published by
|
#include <isqlext.h>
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
#include <dlproc.h>
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
**/
|
|
||||||
|
|
||||||
#include <../iodbc/iodbc.h>
|
#include <herr.h>
|
||||||
|
#include <henv.h>
|
||||||
|
#include <hdbc.h>
|
||||||
|
#include <hstmt.h>
|
||||||
|
|
||||||
#include <../iodbc/isql.h>
|
#include <itrace.h>
|
||||||
#include <../iodbc/isqlext.h>
|
|
||||||
|
|
||||||
#include <../iodbc/dlproc.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <../iodbc/herr.h>
|
RETCODE SQL_API
|
||||||
#include <../iodbc/henv.h>
|
SQLPrepare (
|
||||||
#include <../iodbc/hdbc.h>
|
|
||||||
#include <../iodbc/hstmt.h>
|
|
||||||
|
|
||||||
#include <../iodbc/itrace.h>
|
|
||||||
|
|
||||||
|
|
||||||
RETCODE SQL_API SQLPrepare (
|
|
||||||
HSTMT hstmt,
|
HSTMT hstmt,
|
||||||
UCHAR FAR* szSqlStr,
|
UCHAR FAR * szSqlStr,
|
||||||
SDWORD cbSqlStr )
|
SDWORD cbSqlStr)
|
||||||
{
|
{
|
||||||
STMT_t FAR* pstmt = (STMT_t*)hstmt;
|
STMT_t FAR *pstmt = (STMT_t *) hstmt;
|
||||||
|
|
||||||
HPROC hproc = SQL_NULL_HPROC;
|
HPROC hproc = SQL_NULL_HPROC;
|
||||||
RETCODE retcode = SQL_SUCCESS;
|
RETCODE retcode = SQL_SUCCESS;
|
||||||
int sqlstat = en_00000;
|
int sqlstat = en_00000;
|
||||||
|
|
||||||
if( hstmt == SQL_NULL_HSTMT
|
if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC)
|
||||||
|| pstmt->hdbc == SQL_NULL_HDBC )
|
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check state */
|
/* check state */
|
||||||
if( pstmt->asyn_on == en_NullProc )
|
if (pstmt->asyn_on == en_NullProc)
|
||||||
{
|
{
|
||||||
/* not on asyn state */
|
/* not on asyn state */
|
||||||
switch( pstmt->state )
|
switch (pstmt->state)
|
||||||
{
|
{
|
||||||
case en_stmt_fetched:
|
case en_stmt_fetched:
|
||||||
case en_stmt_xfetched:
|
case en_stmt_xfetched:
|
||||||
@@ -66,52 +78,48 @@ RETCODE SQL_API SQLPrepare (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( pstmt->asyn_on != en_Prepare )
|
else if (pstmt->asyn_on != en_Prepare)
|
||||||
{
|
{
|
||||||
/* asyn on other */
|
/* asyn on other */
|
||||||
sqlstat = en_S1010;
|
sqlstat = en_S1010;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( sqlstat != en_00000 )
|
if (sqlstat != en_00000)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, sqlstat );
|
PUSHSQLERR (pstmt->herr, sqlstat);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( szSqlStr == NULL )
|
if (szSqlStr == NULL)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1009 );
|
PUSHSQLERR (pstmt->herr, en_S1009);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( cbSqlStr < 0 && cbSqlStr != SQL_NTS )
|
if (cbSqlStr < 0 && cbSqlStr != SQL_NTS)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1090 );
|
PUSHSQLERR (pstmt->herr, en_S1090);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
hproc = _iodbcdm_getproc( pstmt->hdbc, en_Prepare );
|
hproc = _iodbcdm_getproc (pstmt->hdbc, en_Prepare);
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
if (hproc == SQL_NULL_HPROC)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
PUSHSQLERR (pstmt->herr, en_IM001);
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_Prepare, (
|
CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_Prepare,
|
||||||
pstmt->dhstmt, szSqlStr, cbSqlStr) )
|
(pstmt->dhstmt, szSqlStr, cbSqlStr))
|
||||||
|
|
||||||
#if 0
|
|
||||||
retcode = hproc ( pstmt->dhstmt, szSqlStr, cbSqlStr );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* stmt state transition */
|
/* stmt state transition */
|
||||||
if( pstmt->asyn_on == en_Prepare )
|
if (pstmt->asyn_on == en_Prepare)
|
||||||
{
|
{
|
||||||
switch( retcode )
|
switch (retcode)
|
||||||
{
|
{
|
||||||
case SQL_SUCCESS:
|
case SQL_SUCCESS:
|
||||||
case SQL_SUCCESS_WITH_INFO:
|
case SQL_SUCCESS_WITH_INFO:
|
||||||
@@ -125,7 +133,7 @@ RETCODE SQL_API SQLPrepare (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( retcode )
|
switch (retcode)
|
||||||
{
|
{
|
||||||
case SQL_STILL_EXECUTING:
|
case SQL_STILL_EXECUTING:
|
||||||
pstmt->asyn_on = en_Prepare;
|
pstmt->asyn_on = en_Prepare;
|
||||||
@@ -138,7 +146,7 @@ RETCODE SQL_API SQLPrepare (
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SQL_ERROR:
|
case SQL_ERROR:
|
||||||
switch( pstmt->state )
|
switch (pstmt->state)
|
||||||
{
|
{
|
||||||
case en_stmt_prepared:
|
case en_stmt_prepared:
|
||||||
case en_stmt_executed:
|
case en_stmt_executed:
|
||||||
@@ -157,45 +165,46 @@ RETCODE SQL_API SQLPrepare (
|
|||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETCODE SQL_API SQLSetCursorName (
|
|
||||||
|
RETCODE SQL_API
|
||||||
|
SQLSetCursorName (
|
||||||
HSTMT hstmt,
|
HSTMT hstmt,
|
||||||
UCHAR FAR* szCursor,
|
UCHAR FAR * szCursor,
|
||||||
SWORD cbCursor )
|
SWORD cbCursor)
|
||||||
{
|
{
|
||||||
STMT_t FAR* pstmt = (STMT_t*)hstmt;
|
STMT_t FAR *pstmt = (STMT_t *) hstmt;
|
||||||
HPROC hproc = SQL_NULL_HPROC;
|
HPROC hproc = SQL_NULL_HPROC;
|
||||||
|
|
||||||
RETCODE retcode = SQL_SUCCESS;
|
RETCODE retcode = SQL_SUCCESS;
|
||||||
int sqlstat = en_00000;
|
int sqlstat = en_00000;
|
||||||
|
|
||||||
if( hstmt == SQL_NULL_HSTMT
|
if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC)
|
||||||
|| pstmt->hdbc == SQL_NULL_HDBC )
|
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( szCursor == NULL )
|
if (szCursor == NULL)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1009 );
|
PUSHSQLERR (pstmt->herr, en_S1009);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( cbCursor < 0 && cbCursor != SQL_NTS )
|
if (cbCursor < 0 && cbCursor != SQL_NTS)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1090 );
|
PUSHSQLERR (pstmt->herr, en_S1090);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check state */
|
/* check state */
|
||||||
if( pstmt->asyn_on != en_NullProc )
|
if (pstmt->asyn_on != en_NullProc)
|
||||||
{
|
{
|
||||||
sqlstat = en_S1010;
|
sqlstat = en_S1010;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch( pstmt->state )
|
switch (pstmt->state)
|
||||||
{
|
{
|
||||||
case en_stmt_executed:
|
case en_stmt_executed:
|
||||||
case en_stmt_cursoropen:
|
case en_stmt_cursoropen:
|
||||||
@@ -215,31 +224,26 @@ RETCODE SQL_API SQLSetCursorName (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( sqlstat != en_00000 )
|
if (sqlstat != en_00000)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, sqlstat );
|
PUSHSQLERR (pstmt->herr, sqlstat);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
hproc = _iodbcdm_getproc( pstmt->hdbc, en_SetCursorName);
|
hproc = _iodbcdm_getproc (pstmt->hdbc, en_SetCursorName);
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
if (hproc == SQL_NULL_HPROC)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
PUSHSQLERR (pstmt->herr, en_IM001);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_SetCursorName, (
|
CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_SetCursorName,
|
||||||
pstmt->dhstmt, szCursor, cbCursor ) )
|
(pstmt->dhstmt, szCursor, cbCursor))
|
||||||
|
|
||||||
#if 0
|
if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
|
||||||
retcode = hproc ( pstmt->dhstmt, szCursor, cbCursor );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if( retcode == SQL_SUCCESS
|
|
||||||
|| retcode == SQL_SUCCESS_WITH_INFO )
|
|
||||||
{
|
{
|
||||||
pstmt->cursor_state = en_stmt_cursor_named;
|
pstmt->cursor_state = en_stmt_cursor_named;
|
||||||
}
|
}
|
||||||
@@ -247,7 +251,9 @@ RETCODE SQL_API SQLSetCursorName (
|
|||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETCODE SQL_API SQLBindParameter (
|
|
||||||
|
RETCODE SQL_API
|
||||||
|
SQLBindParameter (
|
||||||
HSTMT hstmt,
|
HSTMT hstmt,
|
||||||
UWORD ipar,
|
UWORD ipar,
|
||||||
SWORD fParamType,
|
SWORD fParamType,
|
||||||
@@ -257,35 +263,33 @@ RETCODE SQL_API SQLBindParameter (
|
|||||||
SWORD ibScale,
|
SWORD ibScale,
|
||||||
PTR rgbValue,
|
PTR rgbValue,
|
||||||
SDWORD cbValueMax,
|
SDWORD cbValueMax,
|
||||||
SDWORD FAR* pcbValue )
|
SDWORD FAR * pcbValue)
|
||||||
{
|
{
|
||||||
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
STMT_t FAR *pstmt = (STMT_t FAR *) hstmt;
|
||||||
HPROC hproc = SQL_NULL_HPROC;
|
HPROC hproc = SQL_NULL_HPROC;
|
||||||
|
|
||||||
int sqlstat = en_00000;
|
int sqlstat = en_00000;
|
||||||
RETCODE retcode = SQL_SUCCESS;
|
RETCODE retcode = SQL_SUCCESS;
|
||||||
|
|
||||||
if( hstmt == SQL_NULL_HSTMT
|
if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC)
|
||||||
|| pstmt->hdbc == SQL_NULL_HDBC )
|
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check param */
|
/* check param */
|
||||||
if( fSqlType > SQL_TYPE_MAX
|
if (fSqlType > SQL_TYPE_MAX ||
|
||||||
|| ( fSqlType < SQL_TYPE_MIN
|
(fSqlType < SQL_TYPE_MIN && fSqlType > SQL_TYPE_DRIVER_START))
|
||||||
&& fSqlType > SQL_TYPE_DRIVER_START ) )
|
|
||||||
/* Note: SQL_TYPE_DRIVER_START is a nagtive number
|
/* Note: SQL_TYPE_DRIVER_START is a nagtive number
|
||||||
* So, we use ">" */
|
* So, we use ">" */
|
||||||
{
|
{
|
||||||
sqlstat = en_S1004;
|
sqlstat = en_S1004;
|
||||||
}
|
}
|
||||||
else if ( ipar < 1 )
|
else if (ipar < 1)
|
||||||
{
|
{
|
||||||
sqlstat = en_S1093;
|
sqlstat = en_S1093;
|
||||||
}
|
}
|
||||||
else if( (rgbValue == NULL && pcbValue == NULL)
|
else if ((rgbValue == NULL && pcbValue == NULL)
|
||||||
&& fParamType != SQL_PARAM_OUTPUT )
|
&& fParamType != SQL_PARAM_OUTPUT)
|
||||||
{
|
{
|
||||||
sqlstat = en_S1009;
|
sqlstat = en_S1009;
|
||||||
/* This means, I allow output to nowhere
|
/* This means, I allow output to nowhere
|
||||||
@@ -299,15 +303,15 @@ RETCODE SQL_API SQLBindParameter (
|
|||||||
sqlstat = en_S1090;
|
sqlstat = en_S1090;
|
||||||
}
|
}
|
||||||
**********/
|
**********/
|
||||||
else if( fParamType != SQL_PARAM_INPUT
|
else if (fParamType != SQL_PARAM_INPUT
|
||||||
&& fParamType != SQL_PARAM_OUTPUT
|
&& fParamType != SQL_PARAM_OUTPUT
|
||||||
&& fParamType != SQL_PARAM_INPUT_OUTPUT )
|
&& fParamType != SQL_PARAM_INPUT_OUTPUT)
|
||||||
{
|
{
|
||||||
sqlstat = en_S1105;
|
sqlstat = en_S1105;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch( fCType )
|
switch (fCType)
|
||||||
{
|
{
|
||||||
case SQL_C_DEFAULT:
|
case SQL_C_DEFAULT:
|
||||||
case SQL_C_CHAR:
|
case SQL_C_CHAR:
|
||||||
@@ -335,187 +339,170 @@ RETCODE SQL_API SQLBindParameter (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sqlstat != en_00000 )
|
if (sqlstat != en_00000)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, sqlstat );
|
PUSHSQLERR (pstmt->herr, sqlstat);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check state */
|
/* check state */
|
||||||
if( pstmt->state >= en_stmt_needdata
|
if (pstmt->state >= en_stmt_needdata || pstmt->asyn_on != en_NullProc)
|
||||||
|| pstmt->asyn_on != en_NullProc )
|
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1010 );
|
PUSHSQLERR (pstmt->herr, en_S1010);
|
||||||
|
|
||||||
retcode = SQL_ERROR;
|
retcode = SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
hproc = _iodbcdm_getproc( pstmt->hdbc, en_BindParameter );
|
hproc = _iodbcdm_getproc (pstmt->hdbc, en_BindParameter);
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
if (hproc == SQL_NULL_HPROC)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
PUSHSQLERR (pstmt->herr, en_IM001);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_BindParameter, (
|
CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_BindParameter,
|
||||||
pstmt->dhstmt, ipar, fParamType, fCType, fSqlType,
|
(pstmt->dhstmt, ipar, fParamType, fCType, fSqlType, cbColDef,
|
||||||
cbColDef, ibScale, rgbValue, cbValueMax, pcbValue ) )
|
ibScale, rgbValue, cbValueMax, pcbValue))
|
||||||
|
|
||||||
#if 0
|
|
||||||
retcode = hproc(pstmt->dhstmt, ipar, fParamType, fCType, fSqlType,
|
|
||||||
cbColDef, ibScale, rgbValue, cbValueMax, pcbValue );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETCODE SQL_API SQLParamOptions(
|
|
||||||
|
RETCODE SQL_API
|
||||||
|
SQLParamOptions (
|
||||||
HSTMT hstmt,
|
HSTMT hstmt,
|
||||||
UDWORD crow,
|
UDWORD crow,
|
||||||
UDWORD FAR* pirow )
|
UDWORD FAR * pirow)
|
||||||
{
|
{
|
||||||
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
STMT_t FAR *pstmt = (STMT_t FAR *) hstmt;
|
||||||
HPROC hproc;
|
HPROC hproc;
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
|
|
||||||
if( hstmt == SQL_NULL_HSTMT
|
if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC)
|
||||||
|| pstmt->hdbc == SQL_NULL_HDBC )
|
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( crow == (UDWORD)0UL )
|
if (crow == (UDWORD) 0UL)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1107 );
|
PUSHSQLERR (pstmt->herr, en_S1107);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pstmt->state >= en_stmt_needdata
|
if (pstmt->state >= en_stmt_needdata || pstmt->asyn_on != en_NullProc)
|
||||||
|| pstmt->asyn_on != en_NullProc )
|
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1010 );
|
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 )
|
if (hproc == SQL_NULL_HPROC)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
PUSHSQLERR (pstmt->herr, en_IM001);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_ParamOptions, (
|
CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_ParamOptions,
|
||||||
pstmt->dhstmt, crow, pirow) )
|
(pstmt->dhstmt, crow, pirow))
|
||||||
|
|
||||||
#if 0
|
|
||||||
retcode = hproc ( pstmt->dhstmt, crow, pirow );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETCODE SQL_API SQLSetScrollOptions(
|
|
||||||
|
RETCODE SQL_API
|
||||||
|
SQLSetScrollOptions (
|
||||||
HSTMT hstmt,
|
HSTMT hstmt,
|
||||||
UWORD fConcurrency,
|
UWORD fConcurrency,
|
||||||
SDWORD crowKeyset,
|
SDWORD crowKeyset,
|
||||||
UWORD crowRowset )
|
UWORD crowRowset)
|
||||||
{
|
{
|
||||||
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
STMT_t FAR *pstmt = (STMT_t FAR *) hstmt;
|
||||||
HPROC hproc;
|
HPROC hproc;
|
||||||
int sqlstat = en_00000;
|
int sqlstat = en_00000;
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
|
|
||||||
if( hstmt == SQL_NULL_HSTMT
|
if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC)
|
||||||
|| pstmt->hdbc == SQL_NULL_HDBC )
|
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
if( crowRowset == (UWORD)0 )
|
if (crowRowset == (UWORD) 0)
|
||||||
{
|
{
|
||||||
sqlstat = en_S1107;
|
sqlstat = en_S1107;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( crowKeyset > (SDWORD)0L && crowKeyset < (SDWORD)crowRowset )
|
if (crowKeyset > (SDWORD) 0L && crowKeyset < (SDWORD) crowRowset)
|
||||||
{
|
{
|
||||||
sqlstat = en_S1107;
|
sqlstat = en_S1107;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( crowKeyset < 1 )
|
if (crowKeyset < 1)
|
||||||
{
|
{
|
||||||
if( crowKeyset != SQL_SCROLL_FORWARD_ONLY
|
if (crowKeyset != SQL_SCROLL_FORWARD_ONLY
|
||||||
&& crowKeyset != SQL_SCROLL_STATIC
|
&& crowKeyset != SQL_SCROLL_STATIC
|
||||||
&& crowKeyset != SQL_SCROLL_KEYSET_DRIVEN
|
&& crowKeyset != SQL_SCROLL_KEYSET_DRIVEN
|
||||||
&& crowKeyset != SQL_SCROLL_DYNAMIC )
|
&& crowKeyset != SQL_SCROLL_DYNAMIC)
|
||||||
{
|
{
|
||||||
sqlstat = en_S1107;
|
sqlstat = en_S1107;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( fConcurrency != SQL_CONCUR_READ_ONLY
|
if (fConcurrency != SQL_CONCUR_READ_ONLY
|
||||||
&& fConcurrency != SQL_CONCUR_LOCK
|
&& fConcurrency != SQL_CONCUR_LOCK
|
||||||
&& fConcurrency != SQL_CONCUR_ROWVER
|
&& fConcurrency != SQL_CONCUR_ROWVER
|
||||||
&& fConcurrency != SQL_CONCUR_VALUES )
|
&& fConcurrency != SQL_CONCUR_VALUES)
|
||||||
{
|
{
|
||||||
sqlstat = en_S1108;
|
sqlstat = en_S1108;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pstmt->state != en_stmt_allocated )
|
if (pstmt->state != en_stmt_allocated)
|
||||||
{
|
{
|
||||||
sqlstat = en_S1010;
|
sqlstat = en_S1010;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
hproc = _iodbcdm_getproc( pstmt->hdbc, en_SetScrollOptions );
|
hproc = _iodbcdm_getproc (pstmt->hdbc, en_SetScrollOptions);
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
if (hproc == SQL_NULL_HPROC)
|
||||||
{
|
{
|
||||||
sqlstat = en_IM001;
|
sqlstat = en_IM001;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
sqlstat = en_00000;
|
sqlstat = en_00000;
|
||||||
if( 1 ) /* turn off solaris warning message */
|
if (1) /* turn off solaris warning message */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( sqlstat != en_00000 )
|
if (sqlstat != en_00000)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, sqlstat );
|
PUSHSQLERR (pstmt->herr, sqlstat);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_SetScrollOptions, (
|
CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_SetScrollOptions,
|
||||||
pstmt->dhstmt,
|
(pstmt->dhstmt, fConcurrency, crowKeyset, crowRowset))
|
||||||
fConcurrency,
|
|
||||||
crowKeyset,
|
|
||||||
crowRowset ) )
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
retcode = hproc(pstmt->dhstmt,
|
|
||||||
fConcurrency,
|
|
||||||
crowKeyset,
|
|
||||||
crowRowset );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETCODE SQL_API SQLSetParam (
|
|
||||||
|
RETCODE SQL_API
|
||||||
|
SQLSetParam (
|
||||||
HSTMT hstmt,
|
HSTMT hstmt,
|
||||||
UWORD ipar,
|
UWORD ipar,
|
||||||
SWORD fCType,
|
SWORD fCType,
|
||||||
@@ -523,16 +510,16 @@ RETCODE SQL_API SQLSetParam (
|
|||||||
UDWORD cbColDef,
|
UDWORD cbColDef,
|
||||||
SWORD ibScale,
|
SWORD ibScale,
|
||||||
PTR rgbValue,
|
PTR rgbValue,
|
||||||
SDWORD FAR *pcbValue)
|
SDWORD FAR * pcbValue)
|
||||||
{
|
{
|
||||||
return SQLBindParameter(hstmt,
|
return SQLBindParameter (hstmt,
|
||||||
ipar,
|
ipar,
|
||||||
(SWORD)SQL_PARAM_INPUT_OUTPUT,
|
(SWORD) SQL_PARAM_INPUT_OUTPUT,
|
||||||
fCType,
|
fCType,
|
||||||
fSqlType,
|
fSqlType,
|
||||||
cbColDef,
|
cbColDef,
|
||||||
ibScale,
|
ibScale,
|
||||||
rgbValue,
|
rgbValue,
|
||||||
SQL_SETPARAM_VALUE_MAX,
|
SQL_SETPARAM_VALUE_MAX,
|
||||||
pcbValue );
|
pcbValue);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,52 +1,63 @@
|
|||||||
/** Prepare for getting query result
|
/*
|
||||||
|
* result.c
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Prepare for getting query result
|
||||||
|
*
|
||||||
|
* The iODBC driver manager.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the Free
|
||||||
|
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
Copyright (C) 1995 by Ke Jin <kejin@empress.com>
|
#include <config.h>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
#include <isql.h>
|
||||||
it under the terms of the GNU General Public License as published by
|
#include <isqlext.h>
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
#include <dlproc.h>
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
**/
|
|
||||||
|
|
||||||
#include <../iodbc/iodbc.h>
|
#include <herr.h>
|
||||||
|
#include <henv.h>
|
||||||
|
#include <hdbc.h>
|
||||||
|
#include <hstmt.h>
|
||||||
|
|
||||||
#include <../iodbc/isql.h>
|
#include <itrace.h>
|
||||||
#include <../iodbc/isqlext.h>
|
|
||||||
|
|
||||||
#include <../iodbc/dlproc.h>
|
RETCODE SQL_API
|
||||||
|
SQLBindCol (
|
||||||
#include <../iodbc/herr.h>
|
|
||||||
#include <../iodbc/henv.h>
|
|
||||||
#include <../iodbc/hdbc.h>
|
|
||||||
#include <../iodbc/hstmt.h>
|
|
||||||
|
|
||||||
#include <../iodbc/itrace.h>
|
|
||||||
|
|
||||||
RETCODE SQL_API SQLBindCol (
|
|
||||||
HSTMT hstmt,
|
HSTMT hstmt,
|
||||||
UWORD icol,
|
UWORD icol,
|
||||||
SWORD fCType,
|
SWORD fCType,
|
||||||
PTR rgbValue,
|
PTR rgbValue,
|
||||||
SDWORD cbValueMax,
|
SDWORD cbValueMax,
|
||||||
SDWORD FAR* pcbValue )
|
SDWORD FAR * pcbValue)
|
||||||
{
|
{
|
||||||
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
STMT_t FAR *pstmt = (STMT_t FAR *) hstmt;
|
||||||
HPROC hproc = SQL_NULL_HPROC;
|
HPROC hproc = SQL_NULL_HPROC;
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
|
|
||||||
if( hstmt == SQL_NULL_HSTMT
|
if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC)
|
||||||
|| pstmt->hdbc == SQL_NULL_HDBC )
|
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check argument */
|
/* check argument */
|
||||||
switch(fCType)
|
switch (fCType)
|
||||||
{
|
{
|
||||||
case SQL_C_DEFAULT:
|
case SQL_C_DEFAULT:
|
||||||
case SQL_C_CHAR:
|
case SQL_C_CHAR:
|
||||||
@@ -69,219 +80,188 @@ RETCODE SQL_API SQLBindCol (
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1003);
|
PUSHSQLERR (pstmt->herr, en_S1003);
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( cbValueMax < 0 )
|
if (cbValueMax < 0)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1090 );
|
PUSHSQLERR (pstmt->herr, en_S1090);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check state */
|
/* check state */
|
||||||
if( pstmt->state > en_stmt_needdata
|
if (pstmt->state > en_stmt_needdata || pstmt->asyn_on != en_NullProc)
|
||||||
|| pstmt->asyn_on != en_NullProc )
|
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1010 );
|
PUSHSQLERR (pstmt->herr, en_S1010);
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* call driver's function */
|
/* call driver's function */
|
||||||
hproc = _iodbcdm_getproc( pstmt->hdbc, en_BindCol );
|
hproc = _iodbcdm_getproc (pstmt->hdbc, en_BindCol);
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
if (hproc == SQL_NULL_HPROC)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
PUSHSQLERR (pstmt->herr, en_IM001);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_BindCol, (
|
CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_BindCol,
|
||||||
pstmt->dhstmt,
|
(pstmt->dhstmt, icol, fCType, rgbValue, cbValueMax, pcbValue))
|
||||||
icol,
|
|
||||||
fCType,
|
|
||||||
rgbValue,
|
|
||||||
cbValueMax,
|
|
||||||
pcbValue ) )
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
retcode = hproc(pstmt->dhstmt,
|
|
||||||
icol,
|
|
||||||
fCType,
|
|
||||||
rgbValue,
|
|
||||||
cbValueMax,
|
|
||||||
pcbValue );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETCODE SQL_API SQLGetCursorName(
|
|
||||||
|
RETCODE SQL_API
|
||||||
|
SQLGetCursorName (
|
||||||
HSTMT hstmt,
|
HSTMT hstmt,
|
||||||
UCHAR FAR* szCursor,
|
UCHAR FAR * szCursor,
|
||||||
SWORD cbCursorMax,
|
SWORD cbCursorMax,
|
||||||
SWORD FAR* pcbCursor )
|
SWORD FAR * pcbCursor)
|
||||||
{
|
{
|
||||||
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
STMT_t FAR *pstmt = (STMT_t FAR *) hstmt;
|
||||||
HPROC hproc;
|
HPROC hproc;
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
|
|
||||||
if( hstmt == SQL_NULL_HSTMT
|
if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC)
|
||||||
|| pstmt->hdbc == SQL_NULL_HDBC )
|
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check argument */
|
/* check argument */
|
||||||
if( cbCursorMax < (SWORD)0 )
|
if (cbCursorMax < (SWORD) 0)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1090 );
|
PUSHSQLERR (pstmt->herr, en_S1090);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check state */
|
/* check state */
|
||||||
if( pstmt->state >= en_stmt_needdata
|
if (pstmt->state >= en_stmt_needdata || pstmt->asyn_on != en_NullProc)
|
||||||
|| pstmt->asyn_on != en_NullProc )
|
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1010 );
|
PUSHSQLERR (pstmt->herr, en_S1010);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pstmt->state < en_stmt_cursoropen
|
if (pstmt->state < en_stmt_cursoropen
|
||||||
&& pstmt->cursor_state == en_stmt_cursor_no )
|
&& pstmt->cursor_state == en_stmt_cursor_no)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1015 );
|
PUSHSQLERR (pstmt->herr, en_S1015);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* call driver's function */
|
/* call driver's function */
|
||||||
hproc = _iodbcdm_getproc ( pstmt->hdbc, en_GetCursorName );
|
hproc = _iodbcdm_getproc (pstmt->hdbc, en_GetCursorName);
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
if (hproc == SQL_NULL_HPROC)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
PUSHSQLERR (pstmt->herr, en_IM001);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_GetCursorName, (
|
CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_GetCursorName,
|
||||||
pstmt->dhstmt,
|
(pstmt->dhstmt, szCursor, cbCursorMax, pcbCursor))
|
||||||
szCursor,
|
|
||||||
cbCursorMax,
|
|
||||||
pcbCursor ) )
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
retcode = hproc(pstmt->dhstmt,
|
|
||||||
szCursor,
|
|
||||||
cbCursorMax,
|
|
||||||
pcbCursor );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETCODE SQL_API SQLRowCount(
|
|
||||||
|
RETCODE SQL_API
|
||||||
|
SQLRowCount (
|
||||||
HSTMT hstmt,
|
HSTMT hstmt,
|
||||||
SDWORD FAR* pcrow )
|
SDWORD FAR * pcrow)
|
||||||
{
|
{
|
||||||
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
STMT_t FAR *pstmt = (STMT_t FAR *) hstmt;
|
||||||
HPROC hproc;
|
HPROC hproc;
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
|
|
||||||
if( hstmt == SQL_NULL_HSTMT
|
if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC)
|
||||||
|| pstmt->hdbc == SQL_NULL_HDBC )
|
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check state */
|
/* check state */
|
||||||
if( pstmt->state >= en_stmt_needdata
|
if (pstmt->state >= en_stmt_needdata
|
||||||
|| pstmt->state <= en_stmt_prepared
|
|| pstmt->state <= en_stmt_prepared
|
||||||
|| pstmt->asyn_on != en_NullProc )
|
|| pstmt->asyn_on != en_NullProc)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1010 );
|
PUSHSQLERR (pstmt->herr, en_S1010);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* call driver */
|
/* call driver */
|
||||||
hproc = _iodbcdm_getproc( pstmt->hdbc, en_RowCount );
|
hproc = _iodbcdm_getproc (pstmt->hdbc, en_RowCount);
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
if (hproc == SQL_NULL_HPROC)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
PUSHSQLERR (pstmt->herr, en_IM001);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_RowCount, (
|
CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_RowCount,
|
||||||
pstmt->dhstmt, pcrow) )
|
(pstmt->dhstmt, pcrow))
|
||||||
|
|
||||||
#if 0
|
|
||||||
retcode = hproc ( pstmt->dhstmt, pcrow );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETCODE SQL_API SQLNumResultCols(
|
|
||||||
|
RETCODE SQL_API
|
||||||
|
SQLNumResultCols (
|
||||||
HSTMT hstmt,
|
HSTMT hstmt,
|
||||||
SWORD FAR* pccol )
|
SWORD FAR * pccol)
|
||||||
{
|
{
|
||||||
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
STMT_t FAR *pstmt = (STMT_t FAR *) hstmt;
|
||||||
HPROC hproc;
|
HPROC hproc;
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
SWORD ccol;
|
SWORD ccol;
|
||||||
|
|
||||||
if( hstmt == SQL_NULL_HSTMT
|
if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC)
|
||||||
|| pstmt->hdbc == SQL_NULL_HDBC )
|
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check state */
|
/* check state */
|
||||||
if( pstmt->asyn_on == en_NullProc )
|
if (pstmt->asyn_on == en_NullProc)
|
||||||
{
|
{
|
||||||
if( pstmt->state == en_stmt_allocated
|
if (pstmt->state == en_stmt_allocated
|
||||||
|| pstmt->state >= en_stmt_needdata )
|
|| pstmt->state >= en_stmt_needdata)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1010 );
|
PUSHSQLERR (pstmt->herr, en_S1010);
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( pstmt->asyn_on != en_NumResultCols )
|
else if (pstmt->asyn_on != en_NumResultCols)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_S1010 );
|
PUSHSQLERR (pstmt->herr, en_S1010);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* call driver */
|
/* call driver */
|
||||||
hproc = _iodbcdm_getproc( pstmt->hdbc, en_NumResultCols );
|
hproc = _iodbcdm_getproc (pstmt->hdbc, en_NumResultCols);
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
if (hproc == SQL_NULL_HPROC)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
PUSHSQLERR (pstmt->herr, en_IM001);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_NumResultCols, (
|
CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_NumResultCols,
|
||||||
pstmt->dhstmt, &ccol) )
|
(pstmt->dhstmt, &ccol))
|
||||||
|
|
||||||
#if 0
|
|
||||||
retcode = hproc( pstmt->dhstmt, &ccol );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* state transition */
|
/* state transition */
|
||||||
if( pstmt->asyn_on == en_NumResultCols )
|
if (pstmt->asyn_on == en_NumResultCols)
|
||||||
{
|
{
|
||||||
switch( retcode )
|
switch (retcode)
|
||||||
{
|
{
|
||||||
case SQL_SUCCESS:
|
case SQL_SUCCESS:
|
||||||
case SQL_SUCCESS_WITH_INFO:
|
case SQL_SUCCESS_WITH_INFO:
|
||||||
@@ -294,7 +274,7 @@ RETCODE SQL_API SQLNumResultCols(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( retcode )
|
switch (retcode)
|
||||||
{
|
{
|
||||||
case SQL_SUCCESS:
|
case SQL_SUCCESS:
|
||||||
case SQL_SUCCESS_WITH_INFO:
|
case SQL_SUCCESS_WITH_INFO:
|
||||||
@@ -310,7 +290,7 @@ RETCODE SQL_API SQLNumResultCols(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pccol )
|
if (pccol)
|
||||||
{
|
{
|
||||||
*pccol = ccol;
|
*pccol = ccol;
|
||||||
}
|
}
|
||||||
@@ -318,103 +298,86 @@ RETCODE SQL_API SQLNumResultCols(
|
|||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETCODE SQL_API SQLDescribeCol(
|
|
||||||
|
RETCODE SQL_API
|
||||||
|
SQLDescribeCol (
|
||||||
HSTMT hstmt,
|
HSTMT hstmt,
|
||||||
UWORD icol,
|
UWORD icol,
|
||||||
UCHAR FAR* szColName,
|
UCHAR FAR * szColName,
|
||||||
SWORD cbColNameMax,
|
SWORD cbColNameMax,
|
||||||
SWORD FAR* pcbColName,
|
SWORD FAR * pcbColName,
|
||||||
SWORD FAR* pfSqlType,
|
SWORD FAR * pfSqlType,
|
||||||
UDWORD FAR* pcbColDef,
|
UDWORD FAR * pcbColDef,
|
||||||
SWORD FAR* pibScale,
|
SWORD FAR * pibScale,
|
||||||
SWORD FAR* pfNullable )
|
SWORD FAR * pfNullable)
|
||||||
{
|
{
|
||||||
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
STMT_t FAR *pstmt = (STMT_t FAR *) hstmt;
|
||||||
HPROC hproc;
|
HPROC hproc;
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
int sqlstat = en_00000;
|
int sqlstat = en_00000;
|
||||||
|
|
||||||
if( hstmt == SQL_NULL_HSTMT
|
if (hstmt == SQL_NULL_HSTMT
|
||||||
|| pstmt->hdbc == SQL_NULL_HDBC )
|
|| pstmt->hdbc == SQL_NULL_HDBC)
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check arguments */
|
/* check arguments */
|
||||||
if( icol == 0 )
|
if (icol == 0)
|
||||||
{
|
{
|
||||||
sqlstat = en_S1002;
|
sqlstat = en_S1002;
|
||||||
}
|
}
|
||||||
else if( cbColNameMax < 0 )
|
else if (cbColNameMax < 0)
|
||||||
{
|
{
|
||||||
sqlstat = en_S1090;
|
sqlstat = en_S1090;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( sqlstat != en_00000 )
|
if (sqlstat != en_00000)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, sqlstat );
|
PUSHSQLERR (pstmt->herr, sqlstat);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check state */
|
/* check state */
|
||||||
if( pstmt->asyn_on == en_NullProc )
|
if (pstmt->asyn_on == en_NullProc)
|
||||||
{
|
{
|
||||||
if( pstmt->asyn_on == en_stmt_allocated
|
if (pstmt->asyn_on == en_stmt_allocated
|
||||||
|| pstmt->asyn_on >= en_stmt_needdata )
|
|| pstmt->asyn_on >= en_stmt_needdata)
|
||||||
{
|
{
|
||||||
sqlstat = en_S1010;
|
sqlstat = en_S1010;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( pstmt->asyn_on != en_DescribeCol )
|
else if (pstmt->asyn_on != en_DescribeCol)
|
||||||
{
|
{
|
||||||
sqlstat = en_S1010;
|
sqlstat = en_S1010;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( sqlstat != en_00000 )
|
if (sqlstat != en_00000)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, sqlstat );
|
PUSHSQLERR (pstmt->herr, sqlstat);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* call driver */
|
/* call driver */
|
||||||
hproc = _iodbcdm_getproc( pstmt->hdbc, en_DescribeCol );
|
hproc = _iodbcdm_getproc (pstmt->hdbc, en_DescribeCol);
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
if (hproc == SQL_NULL_HPROC)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
PUSHSQLERR (pstmt->herr, en_IM001);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_DescribeCol, (
|
CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_DescribeCol,
|
||||||
pstmt->dhstmt,
|
(pstmt->dhstmt, icol, szColName, cbColNameMax, pcbColName,
|
||||||
icol,
|
pfSqlType, pcbColDef, pibScale, pfNullable))
|
||||||
szColName,
|
|
||||||
cbColNameMax,
|
|
||||||
pcbColName,
|
|
||||||
pfSqlType,
|
|
||||||
pcbColDef,
|
|
||||||
pibScale,
|
|
||||||
pfNullable) )
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
retcode = hproc(pstmt->dhstmt,
|
|
||||||
icol,
|
|
||||||
szColName,
|
|
||||||
cbColNameMax,
|
|
||||||
pcbColName,
|
|
||||||
pfSqlType,
|
|
||||||
pcbColDef,
|
|
||||||
pibScale,
|
|
||||||
pfNullable );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* state transition */
|
/* state transition */
|
||||||
if( pstmt->asyn_on == en_DescribeCol )
|
if (pstmt->asyn_on == en_DescribeCol)
|
||||||
{
|
{
|
||||||
switch( retcode )
|
switch (retcode)
|
||||||
{
|
{
|
||||||
case SQL_SUCCESS:
|
case SQL_SUCCESS:
|
||||||
case SQL_SUCCESS_WITH_INFO:
|
case SQL_SUCCESS_WITH_INFO:
|
||||||
@@ -427,13 +390,13 @@ RETCODE SQL_API SQLDescribeCol(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( pstmt->state )
|
switch (pstmt->state)
|
||||||
{
|
{
|
||||||
case en_stmt_prepared:
|
case en_stmt_prepared:
|
||||||
case en_stmt_cursoropen:
|
case en_stmt_cursoropen:
|
||||||
case en_stmt_fetched:
|
case en_stmt_fetched:
|
||||||
case en_stmt_xfetched:
|
case en_stmt_xfetched:
|
||||||
if( retcode == SQL_STILL_EXECUTING )
|
if (retcode == SQL_STILL_EXECUTING)
|
||||||
{
|
{
|
||||||
pstmt->asyn_on = en_DescribeCol;
|
pstmt->asyn_on = en_DescribeCol;
|
||||||
}
|
}
|
||||||
@@ -446,103 +409,88 @@ RETCODE SQL_API SQLDescribeCol(
|
|||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
RETCODE SQL_API SQLColAttributes(
|
|
||||||
|
RETCODE SQL_API
|
||||||
|
SQLColAttributes (
|
||||||
HSTMT hstmt,
|
HSTMT hstmt,
|
||||||
UWORD icol,
|
UWORD icol,
|
||||||
UWORD fDescType,
|
UWORD fDescType,
|
||||||
PTR rgbDesc,
|
PTR rgbDesc,
|
||||||
SWORD cbDescMax,
|
SWORD cbDescMax,
|
||||||
SWORD FAR* pcbDesc,
|
SWORD FAR * pcbDesc,
|
||||||
SDWORD FAR* pfDesc )
|
SDWORD FAR * pfDesc)
|
||||||
{
|
{
|
||||||
STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
|
STMT_t FAR *pstmt = (STMT_t FAR *) hstmt;
|
||||||
HPROC hproc;
|
HPROC hproc;
|
||||||
RETCODE retcode;
|
RETCODE retcode;
|
||||||
int sqlstat = en_00000;
|
int sqlstat = en_00000;
|
||||||
|
|
||||||
if( hstmt == SQL_NULL_HSTMT
|
if (hstmt == SQL_NULL_HSTMT || pstmt->hdbc == SQL_NULL_HDBC)
|
||||||
|| pstmt->hdbc == SQL_NULL_HDBC )
|
|
||||||
{
|
{
|
||||||
return SQL_INVALID_HANDLE;
|
return SQL_INVALID_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check arguments */
|
/* check arguments */
|
||||||
if( icol == 0 && fDescType != SQL_COLUMN_COUNT )
|
if (icol == 0 && fDescType != SQL_COLUMN_COUNT)
|
||||||
{
|
{
|
||||||
sqlstat = en_S1002;
|
sqlstat = en_S1002;
|
||||||
}
|
}
|
||||||
else if( cbDescMax < 0 )
|
else if (cbDescMax < 0)
|
||||||
{
|
{
|
||||||
sqlstat = en_S1090;
|
sqlstat = en_S1090;
|
||||||
}
|
}
|
||||||
else if(/* fDescType < SQL_COLATT_OPT_MIN || */ /* turnoff warning */
|
else if ( /* fDescType < SQL_COLATT_OPT_MIN || *//* turnoff warning */
|
||||||
( fDescType > SQL_COLATT_OPT_MAX
|
(fDescType > SQL_COLATT_OPT_MAX
|
||||||
&& fDescType < SQL_COLUMN_DRIVER_START ) )
|
&& fDescType < SQL_COLUMN_DRIVER_START))
|
||||||
{
|
{
|
||||||
sqlstat = en_S1091;
|
sqlstat = en_S1091;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( sqlstat != en_00000 )
|
if (sqlstat != en_00000)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, sqlstat );
|
PUSHSQLERR (pstmt->herr, sqlstat);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check state */
|
/* check state */
|
||||||
if( pstmt->asyn_on == en_NullProc )
|
if (pstmt->asyn_on == en_NullProc)
|
||||||
{
|
{
|
||||||
if( pstmt->asyn_on == en_stmt_allocated
|
if (pstmt->asyn_on == en_stmt_allocated
|
||||||
|| pstmt->asyn_on >= en_stmt_needdata )
|
|| pstmt->asyn_on >= en_stmt_needdata)
|
||||||
{
|
{
|
||||||
sqlstat = en_S1010;
|
sqlstat = en_S1010;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( pstmt->asyn_on != en_ColAttributes )
|
else if (pstmt->asyn_on != en_ColAttributes)
|
||||||
{
|
{
|
||||||
sqlstat = en_S1010;
|
sqlstat = en_S1010;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( sqlstat != en_00000 )
|
if (sqlstat != en_00000)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, sqlstat );
|
PUSHSQLERR (pstmt->herr, sqlstat);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* call driver */
|
/* call driver */
|
||||||
hproc = _iodbcdm_getproc( pstmt->hdbc, en_ColAttributes );
|
hproc = _iodbcdm_getproc (pstmt->hdbc, en_ColAttributes);
|
||||||
|
|
||||||
if( hproc == SQL_NULL_HPROC )
|
if (hproc == SQL_NULL_HPROC)
|
||||||
{
|
{
|
||||||
PUSHSQLERR ( pstmt->herr, en_IM001 );
|
PUSHSQLERR (pstmt->herr, en_IM001);
|
||||||
|
|
||||||
return SQL_ERROR;
|
return SQL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_ColAttributes, (
|
CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_ColAttributes,
|
||||||
pstmt->dhstmt,
|
(pstmt->dhstmt, icol, fDescType, rgbDesc, cbDescMax, pcbDesc, pfDesc))
|
||||||
icol,
|
|
||||||
fDescType,
|
|
||||||
rgbDesc,
|
|
||||||
cbDescMax,
|
|
||||||
pcbDesc,
|
|
||||||
pfDesc) )
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
retcode = hproc(pstmt->dhstmt,
|
|
||||||
icol,
|
|
||||||
fDescType,
|
|
||||||
rgbDesc,
|
|
||||||
cbDescMax,
|
|
||||||
pcbDesc,
|
|
||||||
pfDesc );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* state transition */
|
/* state transition */
|
||||||
if( pstmt->asyn_on == en_ColAttributes )
|
if (pstmt->asyn_on == en_ColAttributes)
|
||||||
{
|
{
|
||||||
switch( retcode )
|
switch (retcode)
|
||||||
{
|
{
|
||||||
case SQL_SUCCESS:
|
case SQL_SUCCESS:
|
||||||
case SQL_SUCCESS_WITH_INFO:
|
case SQL_SUCCESS_WITH_INFO:
|
||||||
@@ -555,13 +503,13 @@ RETCODE SQL_API SQLColAttributes(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( pstmt->state )
|
switch (pstmt->state)
|
||||||
{
|
{
|
||||||
case en_stmt_prepared:
|
case en_stmt_prepared:
|
||||||
case en_stmt_cursoropen:
|
case en_stmt_cursoropen:
|
||||||
case en_stmt_fetched:
|
case en_stmt_fetched:
|
||||||
case en_stmt_xfetched:
|
case en_stmt_xfetched:
|
||||||
if( retcode == SQL_STILL_EXECUTING )
|
if (retcode == SQL_STILL_EXECUTING)
|
||||||
{
|
{
|
||||||
pstmt->asyn_on = en_ColAttributes;
|
pstmt->asyn_on = en_ColAttributes;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,145 +0,0 @@
|
|||||||
#ifndef DEBUG
|
|
||||||
|
|
||||||
#endif
|
|
||||||
#ifndef APWIN /* don't reinclude */
|
|
||||||
#define APWIN
|
|
||||||
#ifndef DEBUG
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WININC
|
|
||||||
# include <windows.h> /* normal windows.h */
|
|
||||||
# ifdef WIN32
|
|
||||||
# include <windowsx.h> /* windows extensions */
|
|
||||||
# define GetCurrentTask (HTASK)GetCurrentProcess
|
|
||||||
# define GetDOSEnvironment GetEnvironmentStrings
|
|
||||||
# define PCALL
|
|
||||||
# else
|
|
||||||
# define PCALL PASCAL
|
|
||||||
# endif
|
|
||||||
#else /* not windows */
|
|
||||||
/******* Common definitions and typedefs **********************/
|
|
||||||
#ifdef HPUX
|
|
||||||
# ifndef _VOID
|
|
||||||
# define VOID int
|
|
||||||
# endif
|
|
||||||
# ifndef _UCHAR
|
|
||||||
typedef char UCHAR;
|
|
||||||
# define _UCHAR
|
|
||||||
# endif
|
|
||||||
# ifndef _SCHAR
|
|
||||||
typedef char SCHAR;
|
|
||||||
# define _SCHAR
|
|
||||||
# endif
|
|
||||||
#endif /* HPUX */
|
|
||||||
|
|
||||||
#ifdef OSF1
|
|
||||||
# ifndef _UCHAR
|
|
||||||
typedef char UCHAR;
|
|
||||||
# define _UCHAR
|
|
||||||
# endif
|
|
||||||
# ifndef _SDWORD
|
|
||||||
# define _SDWORD
|
|
||||||
typedef int SDWORD;
|
|
||||||
# endif
|
|
||||||
# ifndef _UDWORD
|
|
||||||
# define _UDWORD
|
|
||||||
typedef unsigned int UDWORD;
|
|
||||||
# endif
|
|
||||||
# ifndef _LDOUBLE
|
|
||||||
# define _LDOUBLE
|
|
||||||
typedef double LDOUBLE;
|
|
||||||
# endif
|
|
||||||
# ifndef _DWORD
|
|
||||||
# define _DWORD
|
|
||||||
typedef int DWORD;
|
|
||||||
# endif
|
|
||||||
#endif /* OSF1 */
|
|
||||||
|
|
||||||
#if defined (SVR4) && defined(I386)
|
|
||||||
# ifndef _UCHAR
|
|
||||||
typedef char UCHAR;
|
|
||||||
# define _UCHAR
|
|
||||||
# endif
|
|
||||||
# ifndef _LDOUBLE
|
|
||||||
# define _LDOUBLE
|
|
||||||
typedef double LDOUBLE;
|
|
||||||
# endif
|
|
||||||
#endif /* SVR4 && I386 */
|
|
||||||
|
|
||||||
#ifndef _VOID
|
|
||||||
# define _VOID
|
|
||||||
# define VOID void
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WIN
|
|
||||||
# define LONG long
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _DWORD
|
|
||||||
# define _DWORD
|
|
||||||
/* typedef unsigned long DWORD; */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _UINT
|
|
||||||
# define _UINT
|
|
||||||
typedef unsigned int UINT;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PC
|
|
||||||
# define FAR _far
|
|
||||||
# define NEAR _near
|
|
||||||
# define PASCAL _pascal
|
|
||||||
# define CDECL _cdecl
|
|
||||||
# define WINAPI _far _pascal
|
|
||||||
# define CALLBACK _far _pascal
|
|
||||||
# define EXPORT _export
|
|
||||||
#else
|
|
||||||
# define FAR
|
|
||||||
# define NEAR
|
|
||||||
# define PASCAL
|
|
||||||
# define CDECL
|
|
||||||
# define WINAPI
|
|
||||||
# define CALLBACK
|
|
||||||
# define EXPORT
|
|
||||||
#endif
|
|
||||||
#define PCALL PASCAL
|
|
||||||
|
|
||||||
/****** Simple types & common helper macros ********************/
|
|
||||||
|
|
||||||
/* typedef int BOOL; */
|
|
||||||
#define FALSE 0
|
|
||||||
#define TRUE 1
|
|
||||||
|
|
||||||
typedef unsigned char BYTE;
|
|
||||||
/* typedef unsigned short WORD; */
|
|
||||||
|
|
||||||
#define LOBYTE(w) ((BYTE)(w))
|
|
||||||
#define HIBYTE(w) ((BYTE)(((UINT)(w) >> 8) & 0xFF))
|
|
||||||
|
|
||||||
#define LOWORD(l) ((WORD)(DWORD)(l))
|
|
||||||
#define HIWORD(l) ((WORD)((((DWORD)(l)) >> 16) & 0xFFFF))
|
|
||||||
|
|
||||||
#define MAKELONG(low, high) ((LONG)(((WORD)(low)) |\
|
|
||||||
(((DWORD)((WORD)(high))) << 16)))
|
|
||||||
|
|
||||||
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
|
||||||
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
|
||||||
|
|
||||||
/****** Common pointer types **********************************/
|
|
||||||
|
|
||||||
#ifndef NULL
|
|
||||||
#define NULL 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/****** Common handle types *************************************/
|
|
||||||
|
|
||||||
typedef UINT HANDLE;
|
|
||||||
/* typedef UINT HWND; */
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* ifdef not WIN */
|
|
||||||
|
|
||||||
#endif /* ifdef APWIN */
|
|
||||||
|
|
||||||
/* end of apwin.h */
|
|
||||||
Reference in New Issue
Block a user